Return an nghttp2-compatible error value for OgHttp2Session::Send(). This change is needed for nghttp2 and Envoy compatibility: - http://google3/third_party/envoy/src/source/common/http/http2/codec_impl.cc;l=1112-1122;rcl=414009764 (H/T Biren) - http://google3/third_party/envoy/src/source/common/http/http2/codec_impl.cc;l=1381;rcl=414009764 PiperOrigin-RevId: 416335543
diff --git a/http2/adapter/oghttp2_adapter_test.cc b/http2/adapter/oghttp2_adapter_test.cc index b274f4a..fccdf1d 100644 --- a/http2/adapter/oghttp2_adapter_test.cc +++ b/http2/adapter/oghttp2_adapter_test.cc
@@ -1517,7 +1517,7 @@ EXPECT_CALL(visitor, OnConnectionError(ConnectionError::kSendError)); int result = adapter->Send(); - EXPECT_EQ(result, Http2VisitorInterface::kSendError); + EXPECT_LT(result, 0); } TEST(OgHttp2AdapterClientTest, ClientForbidsPushPromise) {
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc index 1f6d2fd..09bbe7e 100644 --- a/http2/adapter/oghttp2_session.cc +++ b/http2/adapter/oghttp2_session.cc
@@ -33,6 +33,9 @@ const uint32_t kDefaultHpackTableCapacity = 4096u; const uint32_t kMaximumHpackTableCapacity = 65536u; +// Corresponds to NGHTTP2_ERR_CALLBACK_FAILURE. +const int kSendError = -902; + // TODO(birenroy): Consider incorporating spdy::FlagsSerializionVisitor here. class FrameAttributeCollector : public spdy::SpdyFrameVisitor { public: @@ -492,7 +495,7 @@ if (continue_writing == SendResult::SEND_OK) { continue_writing = SendQueuedFrames(); } - return continue_writing == SendResult::SEND_ERROR ? -1 : 0; + return continue_writing == SendResult::SEND_ERROR ? kSendError : 0; } bool OgHttp2Session::HasReadyStream() const {