Skip to content

Commit

Permalink
Force PoolBuilder to create a new connection when incoming request …
Browse files Browse the repository at this point in the history
…is a websocket upgrade #265
  • Loading branch information
haga-rak committed May 23, 2024
1 parent bfd06a2 commit 251c9c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Fluxzy.Core/Clients/PoolBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,14 @@ public async ValueTask<IHttpConnectionPool>
if (!semaphorePerAuthority.Wait(0))
await semaphorePerAuthority.WaitAsync(cancellationToken).ConfigureAwait(false);

var forceNewConnection = exchange.Context.ForceNewConnection;

if (exchange.Request.Header.IsWebSocketRequest || exchange.Context.BlindMode)
forceNewConnection = true;

// Looking for existing HttpPool

if (!exchange.Context.ForceNewConnection) {
if (!forceNewConnection) {
lock (_connectionPools) {
while (_connectionPools.TryGetValue(exchange.Authority, out var pool)) {
if (pool.Complete) {
Expand Down

0 comments on commit 251c9c4

Please sign in to comment.