Akka.Remote.Transport.Helios.HeliosTransport.Listen C# (CSharp) Метод

Listen() публичный Метод

public Listen ( ) : TaskCompletionSource>>.Task
Результат TaskCompletionSource>>.Task
        public override async Task<Tuple<Address, TaskCompletionSource<IAssociationEventListener>>> Listen()
        {
            EndPoint listenAddress;
            IPAddress ip;
            if (IPAddress.TryParse(Settings.Hostname, out ip))
            {
                listenAddress = new IPEndPoint(ip, Settings.Port);
            }
            else
            {
                listenAddress = new DnsEndPoint(Settings.Hostname, Settings.Port);
            }

            try
            {
                var newServerChannel = await NewServer(listenAddress);


                // Block reads until a handler actor is registered
                // no incoming connections will be accepted until this value is reset
                // it's possible that the first incoming association might come in though
                newServerChannel.Configuration.AutoRead = false;
                ConnectionGroup.TryAdd(newServerChannel);
                ServerChannel = newServerChannel;

                var addr = MapSocketToAddress((IPEndPoint)ServerChannel.LocalAddress, SchemeIdentifier, System.Name,
                    Settings.PublicHostname);
                if (addr == null)
                    throw new ConfigurationException($"Unknown local address type {ServerChannel.LocalAddress}");
                LocalAddress = addr;
                // resume accepting incoming connections
#pragma warning disable 4014 // we WANT this task to run without waiting
                AssociationListenerPromise.Task.ContinueWith(result => ServerChannel.Configuration.AutoRead = true,
                    TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
#pragma warning restore 4014


                return Tuple.Create(addr, AssociationListenerPromise);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to bind to {0}; shutting down Helios transport.", listenAddress);
                try
                {
                    await Shutdown();
                }
                catch
                {
                    // ignore errors occurring during shutdown
                }
                throw;
            }
        }