public AChannel GetChannel(ObjectId id) { UChannel channel = null; this.idChannels.TryGetValue(id, out channel); return(channel); }
public async Task <AChannel> GetChannel() { USocket socket = await this.poller.AcceptAsync(); UChannel channel = new UChannel(socket, this); this.channels[channel.RemoteAddress] = channel; this.idChannels[channel.Id] = channel; return(channel); }
public void Remove(AChannel channel) { UChannel tChannel = channel as UChannel; if (tChannel == null) { return; } this.idChannels.Remove(channel.Id); this.channels.Remove(channel.RemoteAddress); }
public AChannel GetChannel(string host, int port) { UChannel channel = null; if (this.channels.TryGetValue(host + ":" + port, out channel)) { return(channel); } USocket newSocket = new USocket(this.poller); channel = new UChannel(newSocket, host, port, this); this.channels[channel.RemoteAddress] = channel; this.idChannels[channel.Id] = channel; this.SocketConnectAsync(channel); return(channel); }
private void Dispose(bool disposing) { if (this.poller == null) { return; } if (disposing) { foreach (ObjectId id in this.idChannels.Keys.ToArray()) { UChannel channel = this.idChannels[id]; channel.Dispose(); } this.poller.Dispose(); } this.poller = null; }
public AChannel GetChannel(string host, int port) { UChannel channel = null; if (this.channels.TryGetValue(host + ":" + port, out channel)) { return channel; } USocket newSocket = new USocket(this.poller); channel = new UChannel(newSocket, host, port, this); this.channels[channel.RemoteAddress] = channel; this.idChannels[channel.Id] = channel; this.SocketConnectAsync(channel); return channel; }
public async Task<AChannel> GetChannel() { USocket socket = await this.poller.AcceptAsync(); UChannel channel = new UChannel(socket, this); this.channels[channel.RemoteAddress] = channel; this.idChannels[channel.Id] = channel; return channel; }