Commit 12b1a90c authored by Zhu Jiashun's avatar Zhu Jiashun Committed by gejun

- Not close the socket immediately after sending GOAWAY

- Not close the socket when receiving GOAWAY frame to implement gracefully stop
parent f81cc8d4
...@@ -534,8 +534,9 @@ ParseResult H2Context::Consume( ...@@ -534,8 +534,9 @@ ParseResult H2Context::Consume(
wopt.ignore_eovercrowded = true; wopt.ignore_eovercrowded = true;
if (_socket->Write(&sendbuf, &wopt) != 0) { if (_socket->Write(&sendbuf, &wopt) != 0) {
LOG(WARNING) << "Fail to send GOAWAY"; LOG(WARNING) << "Fail to send GOAWAY";
return MakeParseError(PARSE_ERROR_ABSOLUTELY_WRONG);
} }
return MakeParseError(PARSE_ERROR_ABSOLUTELY_WRONG); return MakeMessage(NULL);
} }
} else { } else {
return MakeParseError(PARSE_ERROR_NO_RESOURCE); return MakeParseError(PARSE_ERROR_NO_RESOURCE);
...@@ -900,9 +901,10 @@ H2ParseResult H2Context::OnPing( ...@@ -900,9 +901,10 @@ H2ParseResult H2Context::OnPing(
H2ParseResult H2Context::OnGoAway( H2ParseResult H2Context::OnGoAway(
butil::IOBufBytesIterator&, const H2FrameHead&) { butil::IOBufBytesIterator&, const H2FrameHead&) {
_socket->SetFailed(ELOGOFF, "Received GOAWAY from %s", // TODO(zhujiashun): deal with the stream identifier of the
butil::endpoint2str(_socket->remote_side()).c_str()); // last peer-initiated stream that was or might be processed
return MakeH2Error(H2_PROTOCOL_ERROR); // on the sending endpoint in this connection.
return MakeH2Message(NULL);
} }
H2ParseResult H2Context::OnWindowUpdate( H2ParseResult H2Context::OnWindowUpdate(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment