private async Task SendMessageAsync(Session session, Message message, CancellationToken cancellation)
        {
            var remoteAddress = _addressConversion.DeserializeAddress(session.PhysicalAddress.ToArray()); // TODO: This will copy everything to a new aray

            Assert(remoteAddress != null);

            var physicalEndPoint = GetSessionEndPoint(session);

            try
            {
                await physicalEndPoint.SendAsync(message, remoteAddress, cancellation);
            }
            catch (SocketException) { }
            catch (IOException) { } // The remote session terminated or we just cannot transmit to it.
        }
Exemplo n.º 2
0
        public async ValueTask <IEnumerable <TAddress> > GetMapsAsync(EndPointAddress endPoint, CancellationToken cancellation)
        {
            if (endPoint == default)
            {
                throw new ArgumentDefaultException(nameof(endPoint));
            }

            var endPointEntry = await GetLogicalAddressEntryAsync(endPoint, cancellation);

            Assert(endPointEntry != null);

            var entries = await endPointEntry.GetChildrenEntries().ToArray(cancellation);

            return(entries.Select(p => _addressConversion.DeserializeAddress(p.Value.ToArray())));
        }