Skip to content

Commit

Permalink
Revert "Remove or skip callbacks on old connections" (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraleph authored Dec 13, 2022
1 parent d0e3a4c commit 26deabd
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/src/client/http2_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,7 @@ class Http2ClientConnection implements connection.ClientConnection {

Future<ClientTransportConnection> connectTransport() async {
final connection = await _transportConnector.connect();
_transportConnector.done.then((conn) {
if (conn == _transportConnection) {
// Only abandon the connection if the callback relates to the
// current one.
_abandonConnection();
}
});
_transportConnector.done.then((_) => _abandonConnection());

// Give the settings settings-frame a bit of time to arrive.
// TODO(sigurdm): This is a hack. The http2 package should expose a way of
Expand Down Expand Up @@ -130,9 +124,6 @@ class Http2ClientConnection implements connection.ClientConnection {
final shouldRefresh =
_connectionLifeTimer.elapsed > options.connectionTimeout;
if (shouldRefresh) {
// Deregister onActiveStateChanged callback from connection that we're
// not going to use any more.
_transportConnection!.onActiveStateChanged = (_) {};
_transportConnection!.finish();
}
if (!isHealthy || shouldRefresh) {
Expand Down Expand Up @@ -280,7 +271,7 @@ class Http2ClientConnection implements connection.ClientConnection {
_cancelTimer();
_transportConnection = null;

if (_state == ConnectionState.idle || _state == ConnectionState.shutdown) {
if (_state == ConnectionState.idle && _state == ConnectionState.shutdown) {
// All good.
return;
}
Expand Down

0 comments on commit 26deabd

Please sign in to comment.