Correctly release debugData and notify the promise when goAway was already sent

Motivation:

Commit 908464f161 also introduced a change to guard against re-entrance but failed to correctly handle the debugData and promise.

Modifications:

Release debugData and correctly notify the promise.

Result:

No more buffer leak and promise is always notified.
This commit is contained in:
buchgr 2016-10-14 10:42:03 +02:00 committed by Norman Maurer
parent 97bf3c0a9b
commit af8ef3e40c

View File

@ -677,7 +677,9 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
// Protect against re-entrancy. Could happen if writing the frame fails, and error handling // Protect against re-entrancy. Could happen if writing the frame fails, and error handling
// treating this is a connection handler and doing a graceful shutdown... // treating this is a connection handler and doing a graceful shutdown...
if (lastStreamId == connection().remote().lastStreamKnownByPeer()) { if (lastStreamId == connection().remote().lastStreamKnownByPeer()) {
return promise; // Release the data and notify the promise
debugData.release();
return promise.setSuccess();
} }
if (lastStreamId > connection.remote().lastStreamKnownByPeer()) { if (lastStreamId > connection.remote().lastStreamKnownByPeer()) {
throw connectionError(PROTOCOL_ERROR, "Last stream identifier must not increase between " + throw connectionError(PROTOCOL_ERROR, "Last stream identifier must not increase between " +