private void OnAcceptComplete(object o) { if (_acceptor == null) { return; } var e = o as SocketAsyncEventArgs; if (e.SocketError != SocketError.Success) { Log.Error($"accept error {e.SocketError}"); AcceptAsync(); return; } var channel = new TChannel(e.AcceptSocket, this); IdChannels[channel.Id] = channel; try { OnAccept(channel); } catch (Exception exception) { Log.Error(exception); } if (_acceptor == null) { return; } AcceptAsync(); }
public override BaseChannel ConnectChannel(IPEndPoint ipEndPoint) { var channel = new TChannel(ipEndPoint, this); IdChannels[channel.Id] = channel; return(channel); }