private void OnAccepted(ENetEvent eEvent) { if (eEvent.Type == EventType.Disconnect) { this.AcceptTcs.TrySetException(new Exception("socket disconnected in accpet")); } USocket socket = new USocket(eEvent.Peer, this); this.USocketManager.Add(socket.PeerPtr, socket); socket.OnAccepted(); var tcs = this.AcceptTcs; this.AcceptTcs = null; tcs.SetResult(socket); }
private void OnAccepted(ENetEvent eEvent) { if (eEvent.Type == EventType.Disconnect) { this.AcceptTcs.TrySetException(new Exception("socket disconnected in accpet")); } USocket socket = new USocket(eEvent.Peer, this); this.USocketManager.Add(socket.PeerPtr, socket); socket.OnAccepted(); var tcs = this.AcceptTcs; this.AcceptTcs = null; tcs.SetResult(socket); }