public async Task <ITransport> CreateAsync(MobOperations mobOperations, Identity identity, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, AuditService auditService) { var transport = new TestTransport(this, identity, routingTable, peerTable, inboundMessageDispatcher); transports.Add(transport); // transport discovers existing test transports, they discover transport foreach (var otherTransport in transports) { if (otherTransport == transport) { continue; } var otherTransportNewTransportRoutingContext = new TestRoutingContext(this, identity); otherTransport.SetupRoutingContext(otherTransportNewTransportRoutingContext); otherTransport.PeerTable.GetOrAdd(identity.Id).HandleInboundPeerIdentityUpdate(identity); var newTransportOtherTransportRoutingContext = new TestRoutingContext(this, otherTransport.Identity); transport.SetupRoutingContext(newTransportOtherTransportRoutingContext); transport.PeerTable.GetOrAdd(otherTransport.Identity.Id).HandleInboundPeerIdentityUpdate(otherTransport.Identity); } return(transport); }
public async Task<ITransport> CreateAsync(MobOperations mobOperations, Identity identity, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, AuditService auditService) { var transport = new TestTransport(this, identity, routingTable, peerTable, inboundMessageDispatcher); transports.Add(transport); // transport discovers existing test transports, they discover transport foreach (var otherTransport in transports) { if (otherTransport == transport) continue; var otherTransportNewTransportRoutingContext = new TestRoutingContext(this, identity); otherTransport.SetupRoutingContext(otherTransportNewTransportRoutingContext); otherTransport.PeerTable.GetOrAdd(identity.Id).HandleInboundPeerIdentityUpdate(identity); var newTransportOtherTransportRoutingContext = new TestRoutingContext(this, otherTransport.Identity); transport.SetupRoutingContext(newTransportOtherTransportRoutingContext); transport.PeerTable.GetOrAdd(otherTransport.Identity.Id).HandleInboundPeerIdentityUpdate(otherTransport.Identity); } return transport; }
public void SetupRoutingContext(TestRoutingContext routingContext) { routingContexts.Add(routingContext); routingTable.Register(routingContext.RemoteIdentity.Id, routingContext); }