okhttp: send reset when client receives halfClose from server before sending halfClose.

So that the server side stream can be fully closed.

This fixed #300
This commit is contained in:
Xudong Ma 2015-05-13 14:32:31 -07:00
parent 5efbb6fe73
commit c3125bebdb
1 changed files with 5 additions and 0 deletions

View File

@ -208,6 +208,11 @@ class OkHttpClientStream extends Http2ClientStream {
@Override
public void remoteEndClosed() {
super.remoteEndClosed();
if (canSend()) {
// If server's end-of-stream is received before client sends end-of-stream, we just send a
// reset to server to fully close the server side stream.
frameWriter.rstStream(id(), ErrorCode.CANCEL);
}
transport.finishStream(id(), null, null);
}