public IsQuarantined ( Akka.Actor.Address address, int uid ) : bool | ||
address | Akka.Actor.Address | |
uid | int | |
Résultat | bool |
private void HandleInboundAssociation(InboundAssociation ia) { var readonlyEndpoint = endpoints.ReadOnlyEndpointFor(ia.Association.RemoteAddress); var handle = ia.Association.AsInstanceOf <AkkaProtocolHandle>(); if (readonlyEndpoint != null) { if (pendingReadHandoffs.ContainsKey(readonlyEndpoint)) { pendingReadHandoffs[readonlyEndpoint].Disassociate(); } pendingReadHandoffs.AddOrSet(readonlyEndpoint, handle); readonlyEndpoint.Tell(new EndpointWriter.TakeOver(handle)); } else { if (endpoints.IsQuarantined(handle.RemoteAddress, (int)handle.HandshakeInfo.Uid)) { handle.Disassociate(DisassociateInfo.Quarantined); } else { endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress).Match() .With <Pass>(pass => { if (!pass.Uid.HasValue) { if (stashedInbound.ContainsKey(pass.Endpoint)) { stashedInbound[pass.Endpoint].Add(ia); } else { stashedInbound.AddOrSet(pass.Endpoint, new List <InboundAssociation>() { ia }); } } else { if (handle.HandshakeInfo.Uid == pass.Uid) { if (pendingReadHandoffs.ContainsKey(pass.Endpoint)) { pendingReadHandoffs[pass.Endpoint].Disassociate(); } pendingReadHandoffs.AddOrSet(pass.Endpoint, handle); pass.Endpoint.Tell(new EndpointWriter.StoppedReading(pass.Endpoint)); } else { Context.Stop((InternalActorRef)pass.Endpoint); endpoints.UnregisterEndpoint(pass.Endpoint); pendingReadHandoffs.Remove(pass.Endpoint); CreateAndRegisterEndpoint(handle, pass.Uid); } } }) .Default(state => { CreateAndRegisterEndpoint(handle, null); }); } } }
private void HandleInboundAssociation(InboundAssociation ia) { var readonlyEndpoint = endpoints.ReadOnlyEndpointFor(ia.Association.RemoteAddress); var handle = ((AkkaProtocolHandle)ia.Association); if (readonlyEndpoint != null) { if (pendingReadHandoffs.ContainsKey(readonlyEndpoint)) { pendingReadHandoffs[readonlyEndpoint].Disassociate(); } pendingReadHandoffs.AddOrSet(readonlyEndpoint, handle); readonlyEndpoint.Tell(new EndpointWriter.TakeOver(handle, Self)); } else { if (endpoints.IsQuarantined(handle.RemoteAddress, (int)handle.HandshakeInfo.Uid)) { handle.Disassociate(DisassociateInfo.Quarantined); } else { if (endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress) is Pass) { var pass = (Pass)endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress); if (!pass.Uid.HasValue) { if (stashedInbound.ContainsKey(pass.Endpoint)) { stashedInbound[pass.Endpoint].Add(ia); } else { stashedInbound.AddOrSet(pass.Endpoint, new List <InboundAssociation>() { ia }); } } else { if (handle.HandshakeInfo.Uid == pass.Uid) { if (pendingReadHandoffs.ContainsKey(pass.Endpoint)) { pendingReadHandoffs[pass.Endpoint].Disassociate(); } pendingReadHandoffs.AddOrSet(pass.Endpoint, handle); pass.Endpoint.Tell(new EndpointWriter.StopReading(pass.Endpoint, Self)); } else { Context.Stop(pass.Endpoint); endpoints.UnregisterEndpoint(pass.Endpoint); pendingReadHandoffs.Remove(pass.Endpoint); CreateAndRegisterEndpoint(handle, pass.Uid); } } } else { var state = endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress); CreateAndRegisterEndpoint(handle, null); } } } }
private void HandleInboundAssociation(InboundAssociation ia, bool writerIsIdle) { var readonlyEndpoint = _endpoints.ReadOnlyEndpointFor(ia.Association.RemoteAddress); var handle = ((AkkaProtocolHandle)ia.Association); if (readonlyEndpoint != null) { var endpoint = readonlyEndpoint.Item1; if (_pendingReadHandoffs.ContainsKey(endpoint)) { _pendingReadHandoffs[endpoint].Disassociate(); } _pendingReadHandoffs.AddOrSet(endpoint, handle); endpoint.Tell(new EndpointWriter.TakeOver(handle, Self)); _endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress).Match() .With <Pass>(pass => { pass.Endpoint.Tell(new ReliableDeliverySupervisor.Ungate()); }); } else { if (_endpoints.IsQuarantined(handle.RemoteAddress, handle.HandshakeInfo.Uid)) { handle.Disassociate(DisassociateInfo.Quarantined); } else { var policy = _endpoints.WritableEndpointWithPolicyFor(handle.RemoteAddress); var pass = policy as Pass; if (pass != null && !pass.Uid.HasValue) { // Idle writer will never send a GotUid or a Terminated so we need to "provoke it" // to get an unstash event if (!writerIsIdle) { pass.Endpoint.Tell(ReliableDeliverySupervisor.IsIdle.Instance); var stashedInboundForEp = _stashedInbound.GetOrElse(pass.Endpoint, new List <InboundAssociation>()); stashedInboundForEp.Add(ia); _stashedInbound[pass.Endpoint] = stashedInboundForEp; } else { CreateAndRegisterEndpoint(handle, _endpoints.RefuseUid(handle.RemoteAddress)); } } else if (pass != null) // has a UID value { if (handle.HandshakeInfo.Uid == pass.Uid) { _pendingReadHandoffs.GetOrElse(pass.Endpoint, null)?.Disassociate(); _pendingReadHandoffs.AddOrSet(pass.Endpoint, handle); pass.Endpoint.Tell(new EndpointWriter.StopReading(pass.Endpoint, Self)); pass.Endpoint.Tell(new ReliableDeliverySupervisor.Ungate()); } else { Context.Stop(pass.Endpoint); _endpoints.UnregisterEndpoint(pass.Endpoint); _pendingReadHandoffs.Remove(pass.Endpoint); CreateAndRegisterEndpoint(handle, pass.Uid); } } else { CreateAndRegisterEndpoint(handle, _endpoints.RefuseUid(handle.RemoteAddress)); } } } }