void Delivery_OnDisconnected(DeliveryConnection conn) { // decrement the counter keeping track of the total number of clients connected to the server m_maxNumberAcceptedClients.Release(); ReceiveEventArgs_Release(conn.receiveEventArgs); connMap.TryRemove(conn.GetHashCode(), out _); //conn.Close(); }
private DeliveryConnection Delivery_OnConnected(global::System.Net.Sockets.Socket socket) { var conn = new DeliveryConnection(); conn.Init(socket); conn.Conn_OnDisconnected = Delivery_OnDisconnected; connMap[conn.GetHashCode()] = conn; try { Conn_OnConnected?.Invoke(conn); } catch (Exception ex) { Logger.Error(ex); } return(conn); }