예제 #1
0
 /// <summary>Notifies the server that a client has disconnected</summary>
 /// <param name="client">Client that has disconnected</param>
 internal void NotifyClientDisconnected(ClientConnection client) {
   lock(this.connectedClients) {
     ConnectionEntry entry;
     if(this.connectedClients.TryGetValue(client, out entry)) {
       ClientConnection connection = entry.Connection;
       entry.Connection = null;
       this.connectedClients.Remove(connection);
     }
   }
 }
예제 #2
0
 /// <summary>Initializes a new connection entry</summary>
 /// <param name="connection">Connected HTTP client to store in the entry</param>
 public ConnectionEntry(ClientConnection connection) {
   this.Connection = connection;
 }
예제 #3
0
    /// <summary>Drops all clients currently connected to the server</summary>
    public void DropAllClients() {
      int connectionCount;
      ClientConnection[] clientConnections;

      lock(this.connectedClients) {
        connectionCount = this.connectedClients.Count;
        clientConnections = new ClientConnection[connectionCount];
        this.connectedClients.Keys.CopyTo(clientConnections, 0);
      }

      for(; connectionCount > 0; --connectionCount) {
        clientConnections[connectionCount - 1].Drop();
      }
    }