MapSocketToAddress() public static method

public static MapSocketToAddress ( IPEndPoint socketAddr, string schemeIdentifier, string systemName, string hostName = null ) : Akka.Actor.Address
socketAddr System.Net.IPEndPoint
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);
        }
Example #2
0
        /// <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();
            }
        }