public static MapSocketToAddress ( |
||
socketAddr | ||
schemeIdentifier | string | |
systemName | string | |
hostName | string | |
return | Akka.Actor.Address |
void InitInbound(IChannel channel, IPEndPoint socketAddress, object msg) { // disable automatic reads channel.Configuration.AutoRead = false; _associationEventListener.ContinueWith(r => { var listener = r.Result; var remoteAddress = HeliosTransport.MapSocketToAddress(socketAddress, WrappedTransport.SchemeIdentifier, WrappedTransport.System.Name); AssociationHandle handle; Init(channel, socketAddress, remoteAddress, msg, out handle); listener.Notify(new InboundAssociation(handle)); }, TaskContinuationOptions.OnlyOnRanToCompletion); }
/// <summary> /// TBD /// </summary> /// <param name="channel">TBD</param> /// <param name="remoteSocketAddress">TBD</param> /// <param name="remoteAddress">TBD</param> /// <param name="msg">TBD</param> /// <param name="op">TBD</param> protected void Init(IChannel channel, IPEndPoint remoteSocketAddress, Address remoteAddress, object msg, out AssociationHandle op) { var localAddress = HeliosTransport.MapSocketToAddress((IPEndPoint)channel.LocalAddress, WrappedTransport.SchemeIdentifier, WrappedTransport.System.Name, WrappedTransport.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(); } }