/// <summary> /// Removes the client from the collection and disposes it. /// </summary> /// <param name="client"></param> protected void Remove(SocketClient client) { using(TimedLock.Lock(_connections)) { _connections.Remove(client); } client.Dispose(); }
/// <summary> /// Tries to add the SocketClient instance to the collection. /// If there is no room, it returns false. /// </summary> /// <param name="socket"></param> /// <returns></returns> /// <exception cref="GU.Threading.LockTimeoutException"> /// Thrown if a lock on the internal list cannot be acquired. /// </exception> public void Add(SocketClient client) { if(this._isDisposed) throw new ObjectDisposedException(GetType().Name, "This object is disposed."); using(TimedLock.Lock(_connections)) { _connections.Add(client); } client.SocketDisconnected += new SocketDisconnectedEventHandler(SocketDisconnected); }
public SocketClientConnectedEventArgs(SocketClient socketClient) : base() { _socketClient = socketClient; }
/// <summary> /// Fires the SocketClientConnect event. /// </summary> /// <param name="client"></param> protected virtual void OnSocketClientConnected(SocketClient client) { if(SocketClientConnected != null) { Log.Info("Firing ClientSocketConnected Event"); //TODO: We may want to fire this asynchronously so that we do // not block on this thread. SocketClientConnected(this, new SocketClientConnectedEventArgs(client)); } }