Beispiel #1
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="remoteAddress">TBD</param>
        /// <returns>TBD</returns>
        public override Task <AssociationHandle> Associate(Address remoteAddress)
        {
            var statusPromise = new TaskCompletionSource <AssociationHandle>();

            InterceptAssociate(SchemeAugmenter.RemoveScheme(remoteAddress), statusPromise);
            return(statusPromise.Task);
        }
Beispiel #2
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="originalLocalAddress">TBD</param>
 /// <param name="originalRemoteAddress">TBD</param>
 /// <param name="wrappedHandle">TBD</param>
 /// <param name="addedSchemeIdentifier">TBD</param>
 protected AbstractTransportAdapterHandle(Address originalLocalAddress, Address originalRemoteAddress, AssociationHandle wrappedHandle, string addedSchemeIdentifier) : base(originalLocalAddress, originalRemoteAddress)
 {
     WrappedHandle         = wrappedHandle;
     OriginalRemoteAddress = originalRemoteAddress;
     OriginalLocalAddress  = originalLocalAddress;
     SchemeAugmenter       = new SchemeAugmenter(addedSchemeIdentifier);
     RemoteAddress         = SchemeAugmenter.AugmentScheme(OriginalRemoteAddress);
     LocalAddress          = SchemeAugmenter.AugmentScheme(OriginalLocalAddress);
 }
Beispiel #3
0
        public Task <AkkaProtocolHandle> Associate(Address remoteAddress, int?refuseUid)
        {
            // Prepare a Task and pass its completion source to the manager
            var statusPromise = new TaskCompletionSource <AssociationHandle>();

            manager.Tell(new AssociateUnderlyingRefuseUid(SchemeAugmenter.RemoveScheme(remoteAddress), statusPromise, refuseUid));

            return(statusPromise.Task.CastTask <AssociationHandle, AkkaProtocolHandle>());
        }
Beispiel #4
0
        public Task <AkkaProtocolHandle> Associate(Address remoteAddress, int?refuseUid)
        {
            // Prepare a Task and pass its completion source to the manager
            var statusPromise = new TaskCompletionSource <AssociationHandle>();

            manager.Tell(new AssociateUnderlyingRefuseUid(SchemeAugmenter.RemoveScheme(remoteAddress), statusPromise, refuseUid));

            return(statusPromise.Task.ContinueWith(result => result.Result.AsInstanceOf <AkkaProtocolHandle>(),
                                                   TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.ExecuteSynchronously));
        }
Beispiel #5
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <returns>TBD</returns>
        public override Task <(Address, TaskCompletionSource <IAssociationEventListener>)> Listen()
        {
            var upstreamListenerPromise = new TaskCompletionSource <IAssociationEventListener>();

            return(WrappedTransport.Listen().ContinueWith(async listenerTask =>
            {
                var listenAddress = listenerTask.Result.Item1;
                var listenerPromise = listenerTask.Result.Item2;
                listenerPromise.TrySetResult(await InterceptListen(listenAddress, upstreamListenerPromise.Task).ConfigureAwait(false));
                return (SchemeAugmenter.AugmentScheme(listenAddress), upstreamListenerPromise);
            }, TaskContinuationOptions.ExecuteSynchronously).Unwrap());
        }