public static Props InboundProps(HandshakeInfo handshakeInfo, AssociationHandle wrappedHandle, IAssociationEventListener associationEventListener, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector) { return (Props.Create( () => new ProtocolStateActor(handshakeInfo, wrappedHandle, associationEventListener, settings, codec, failureDetector))); }
public override ByteString ConstructAssociate(HandshakeInfo info) { var handshakeInfo = AkkaHandshakeInfo.CreateBuilder() .SetOrigin(SerializeAddress(info.Origin)) .SetUid((ulong)info.Uid); return(ConstructControlMessagePdu(CommandType.ASSOCIATE, handshakeInfo)); }
/// <summary> /// Constructor for outbound ProtocolStateActors /// </summary> public ProtocolStateActor(HandshakeInfo handshakeInfo, Address remoteAddress, TaskCompletionSource <AssociationHandle> statusCompletionSource, Transport transport, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector, int?refuseUid = null) : this( new OutboundUnassociated(remoteAddress, statusCompletionSource, transport), handshakeInfo, settings, codec, failureDetector, refuseUid) { }
/// <summary> /// TBD /// </summary> /// <param name="info">TBD</param> /// <exception cref="ArgumentException"> /// This exception is thrown when the specified <paramref name="info"/> contains an invalid address. /// </exception> /// <returns>TBD</returns> public override ByteString ConstructAssociate(HandshakeInfo info) { var handshakeInfo = new AkkaHandshakeInfo() { Origin = SerializeAddress(info.Origin), Uid = (ulong)info.Uid }; return(ConstructControlMessagePdu(CommandType.Associate, handshakeInfo)); }
public AkkaProtocolHandle(Address originalLocalAddress, Address originalRemoteAddress, TaskCompletionSource <IHandleEventListener> readHandlerCompletionSource, AssociationHandle wrappedHandle, HandshakeInfo handshakeInfo, ActorRef stateActor, AkkaPduCodec codec) : base(originalLocalAddress, originalRemoteAddress, wrappedHandle, RemoteSettings.AkkaScheme) { HandshakeInfo = handshakeInfo; StateActor = stateActor; ReadHandlerSource = readHandlerCompletionSource; Codec = codec; }
private bool SendAssociate(AssociationHandle wrappedHandle, HandshakeInfo info) { try { return(wrappedHandle.Write(_codec.ConstructAssociate(info))); } catch (Exception ex) { throw new AkkaProtocolException("Error writing ASSOCIATE to transport", ex); } }
private Task <IHandleEventListener> NotifyOutboundHandler(AssociationHandle wrappedHandle, HandshakeInfo handshakeInfo, TaskCompletionSource <AssociationHandle> statusPromise) { var readHandlerPromise = new TaskCompletionSource <IHandleEventListener>(); ListenForListenerRegistration(readHandlerPromise); statusPromise.SetResult(new AkkaProtocolHandle(_localAddress, wrappedHandle.RemoteAddress, readHandlerPromise, wrappedHandle, handshakeInfo, Self, _codec)); return(readHandlerPromise.Task); }
/// <summary> /// Common constructor used by both the outbound and the inboud cases /// </summary> protected ProtocolStateActor(InitialProtocolStateData initialData, HandshakeInfo localHandshakeInfo, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector, int?refuseUid) { _initialData = initialData; _localHandshakeInfo = localHandshakeInfo; _settings = settings; _refuseUid = refuseUid; _localAddress = _localHandshakeInfo.Origin; _codec = codec; _failureDetector = failureDetector; InitializeFSM(); }
private Task <IHandleEventListener> NotifyInboundHandler(AssociationHandle wrappedHandle, HandshakeInfo handshakeInfo, IAssociationEventListener associationEventListener) { var readHandlerPromise = new TaskCompletionSource <IHandleEventListener>(); ListenForListenerRegistration(readHandlerPromise); associationEventListener.Notify( new InboundAssociation( new AkkaProtocolHandle(_localAddress, handshakeInfo.Origin, readHandlerPromise, wrappedHandle, handshakeInfo, Self, _codec))); return(readHandlerPromise.Task); }
public Associate(HandshakeInfo info) { Info = info; }
public abstract ByteString ConstructAssociate(HandshakeInfo info);
public static Props OutboundProps(HandshakeInfo handshakeInfo, Address remoteAddress, TaskCompletionSource <AssociationHandle> statusCompletionSource, Transport transport, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector, int?refuseUid = null) { return(Props.Create(() => new ProtocolStateActor(handshakeInfo, remoteAddress, statusCompletionSource, transport, settings, codec, failureDetector, refuseUid))); }
/// <summary> /// Constructor for inbound ProtocolStateActors /// </summary> public ProtocolStateActor(HandshakeInfo handshakeInfo, AssociationHandle wrappedHandle, IAssociationEventListener associationEventListener, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector) : this(new InboundUnassociated(associationEventListener, wrappedHandle), handshakeInfo, settings, codec, failureDetector, refuseUid : null) { }
private bool Equals(HandshakeInfo other) { return(Equals(Origin, other.Origin) && Uid == other.Uid); }