File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -205,10 +205,12 @@ let runServer maxConcurrentOps bufferSize (binding: SocketBinding) (runtime:Http
205205 { ip = rep.Address; port = uint16 rep.Port }
206206
207207 while not ( cancellationToken.IsCancellationRequested) do
208- let connection : ConnectionFacade = connectionPool.Pop()
209208 try
210209 let! acceptedSocket = listenSocket.AcceptAsync( cancellationToken)
211210
211+ // Only pop a connection AFTER we have an accepted socket
212+ let connection : ConnectionFacade = connectionPool.Pop()
213+
212214 // Set the accepted socket and perform SSL handshake if needed
213215 let! remoteBindingResult = task {
214216 match connection.Connection.transport with
@@ -248,8 +250,6 @@ let runServer maxConcurrentOps bufferSize (binding: SocketBinding) (runtime:Http
248250 // SSL handshake failed, return connection to pool
249251 connectionPool.Push( connection)
250252 with ex ->
251- // Return connection to pool if accept failed
252- connectionPool.Push( connection)
253253 // Re-raise if not a cancellation exception
254254 match ex with
255255 | :? OperationCanceledException -> ()
You can’t perform that action at this time.
0 commit comments