void InitInbound(IChannel channel, IPEndPoint socketAddress, object msg) { // disable automatic reads channel.Configuration.AutoRead = false; _associationEventListener.ContinueWith(r => { var listener = r.Result; var remoteAddress = DotNettyTransport.MapSocketToAddress( socketAddress: socketAddress, schemeIdentifier: Transport.SchemeIdentifier, systemName: Transport.System.Name); Init(channel, socketAddress, remoteAddress, msg, out var handle); listener.Notify(new InboundAssociation(handle)); }, TaskContinuationOptions.OnlyOnRanToCompletion); }
protected void Init(IChannel channel, IPEndPoint remoteSocketAddress, Address remoteAddress, object msg, out AssociationHandle op) { var localAddress = DotNettyTransport.MapSocketToAddress((IPEndPoint)channel.LocalAddress, Transport.SchemeIdentifier, Transport.System.Name, Transport.Settings.Hostname); if (localAddress != null) { var handle = CreateHandle(channel, localAddress, remoteAddress); handle.ReadHandlerSource.Task.ContinueWith(s => { var listener = s.Result; RegisterListener(channel, listener, msg, remoteSocketAddress); channel.Configuration.AutoRead = true; // turn reads back on }, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.NotOnFaulted); op = handle; } else { op = null; channel.CloseAsync(); } }
protected TcpHandlers(DotNettyTransport transport, ILoggingAdapter log) : base(transport, log) { }
public TcpAssociationHandle(Address localAddress, Address remoteAddress, DotNettyTransport transport, IChannel channel) : base(localAddress, remoteAddress) { _channel = channel; }
public TcpClientHandler(DotNettyTransport transport, ILoggingAdapter log, Address remoteAddress) : base(transport, log) { _remoteAddress = remoteAddress; }
public TcpServerHandler(DotNettyTransport transport, ILoggingAdapter log, Task <IAssociationEventListener> associationEventListener) : base(transport, log) { this._associationEventListener = associationEventListener; }
protected CommonHandlers(DotNettyTransport transport, ILoggingAdapter log) { Transport = transport; Log = log; }