Skip to content

Commit

Permalink
Issue #4904 - WebsocketClient creates more connections than needed.
Browse files Browse the repository at this point in the history
Fixed MaxConcurrentStreamsTest - it was always broken.
The problem was that the call to super.onSettings(...) was done
_after_ sending the request, so the connection pool was still
configured with the default maxMultiplex=1024.

Also fixed AbstractConnectionPool to avoid a second call to
activate() if we are not trying to create a new connection.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Jul 9, 2020
1 parent 6844c93 commit 94956d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ public Connection acquire()
protected Connection acquire(boolean create)
{
Connection connection = activate();
if (connection == null)
if (connection == null && create)
{
if (create)
tryCreate(destination.getQueuedRequestCount());
tryCreate(destination.getQueuedRequestCount());
connection = activate();
}
return connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ protected void connect(SslContextFactory sslContextFactory, InetSocketAddress ad
@Override
public void onSettings(Session session, SettingsFrame frame)
{
super.onSettings(session, frame);
// Send another request to simulate a request being
// sent concurrently with connection establishment.
// Sending this request will trigger the creation of
Expand All @@ -200,7 +201,6 @@ public void onSettings(Session session, SettingsFrame frame)
}
});
}
super.onSettings(session, frame);
}
}, promise, context);
}
Expand Down

0 comments on commit 94956d6

Please sign in to comment.