コード例 #1
0
        private async Task PerformDisconnectCore(string connectionId, bool waitForApplicationTask, bool closeGracefully = true)
        {
            // remove the connection from the global store so that a connection with the same connectionId can be added from elsewhere
            if (_clientConnectionManager.TryRemoveClientConnection(connectionId, out _))
            {
                if (_clientConnections.TryRemove(connectionId, out var clientContext))
                {
                    if (waitForApplicationTask)
                    {
                        await WaitForApplicationTask(clientContext, closeGracefully);
                    }

                    clientContext.Transport?.OnDisconnected();
                    Log.ConnectedEnding(Logger, connectionId);
                }
            }
        }
コード例 #2
0
 private ClientConnectionContext RemoveClientConnection(string connectionId)
 {
     _connectionIds.TryRemove(connectionId, out _);
     _clientConnectionManager.TryRemoveClientConnection(connectionId, out var connection);
     return(connection);
 }