public void add_connection(Transceiver connection) { this.request_access(); int start_size; int end_size; start_size = this._connections.Count; if(!this._connections.Contains(connection)) { this._connections[connection.GetHashCode()] = connection; } else { this.relieve_access(); throw new Exception("Connection is already contained in list."); } end_size = this._connections.Count; this.relieve_access(); if(end_size == start_size) { throw new Exception("Failed to add connection to list."); } }
public void Disconnect(Transceiver connection) { connection.Close(); this._deleteConnection(connection); this.NotifyOfDisconnect(connection); Logger.log("Connection has been closed and removed. Code: "+connection.GetHashCode(), Logger.Verbosity.moderate); }