public UdpUnicasterFactory(Identity identity, UdpClient udpClient, AcknowledgementCoordinator acknowledgementCoordinator, IObjectPool<byte[]> sendReceiveBufferPool, IAuditCounter resendsCounter, IAuditAggregator<int> resendsAggregator, IAuditAggregator<double> outboundMessageRateLimitAggregator, IAuditAggregator<double> sendQueueDepthAggregator) {
    this.identity = identity;
    this.udpClient = udpClient;
    this.acknowledgementCoordinator = acknowledgementCoordinator;
    this.sendReceiveBufferPool = sendReceiveBufferPool;
    this.resendsCounter = resendsCounter;
    this.resendsAggregator = resendsAggregator;
    this.outboundMessageRateLimitAggregator = outboundMessageRateLimitAggregator;
    this.sendQueueDepthAggregator = sendQueueDepthAggregator;
 }
Ejemplo n.º 2
0
 public UdpUnicasterFactory(Identity identity, UdpClient udpClient, AcknowledgementCoordinator acknowledgementCoordinator, IObjectPool <byte[]> sendReceiveBufferPool, IAuditCounter resendsCounter, IAuditAggregator <int> resendsAggregator, IAuditAggregator <double> outboundMessageRateLimitAggregator, IAuditAggregator <double> sendQueueDepthAggregator)
 {
     this.identity  = identity;
     this.udpClient = udpClient;
     this.acknowledgementCoordinator         = acknowledgementCoordinator;
     this.sendReceiveBufferPool              = sendReceiveBufferPool;
     this.resendsCounter                     = resendsCounter;
     this.resendsAggregator                  = resendsAggregator;
     this.outboundMessageRateLimitAggregator = outboundMessageRateLimitAggregator;
     this.sendQueueDepthAggregator           = sendQueueDepthAggregator;
 }
Ejemplo n.º 3
0
 public UdpUnicaster(Identity identity, UdpClient udpClient, AcknowledgementCoordinator acknowledgementCoordinator, IObjectPool <byte[]> sendReceiveBufferPool, UdpClientRemoteInfo remoteInfo, IAuditCounter resendsCounter, IAuditAggregator <int> resendsAggregator, IAuditAggregator <double> outboundMessageRateLimitAggregator, IAuditAggregator <double> sendQueueDepthAggregator)
 {
     this.outboundPacketMemoryStreamPool = new ByteArrayPoolBackedMemoryStreamPool(sendReceiveBufferPool);
     this.identity  = identity;
     this.udpClient = udpClient;
     this.acknowledgementCoordinator = acknowledgementCoordinator;
     this.remoteInfo        = remoteInfo;
     this.resendsCounter    = resendsCounter;
     this.resendsAggregator = resendsAggregator;
     this.outboundMessageRateLimitAggregator = outboundMessageRateLimitAggregator;
     this.sendQueueDepthAggregator           = sendQueueDepthAggregator;
 }
Ejemplo n.º 4
0
 public UdpDispatcherImpl(Identity identity, UdpClient udpClient, DuplicateFilter duplicateFilter, PayloadSender payloadSender, AcknowledgementCoordinator acknowledgementCoordinator, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, MultiPartPacketReassembler multiPartPacketReassembler, IUdpUnicasterFactory udpUnicasterFactory, IAuditCounter announcementsReceivedCounter, IAuditCounter tossedCounter, IAuditCounter duplicateReceivesCounter, IAuditAggregator<int> multiPartChunksBytesReceivedAggregator) {
    this.identity = identity;
    this.udpClient = udpClient;
    this.duplicateFilter = duplicateFilter;
    this.payloadSender = payloadSender;
    this.acknowledgementCoordinator = acknowledgementCoordinator;
    this.routingTable = routingTable;
    this.peerTable = peerTable;
    this.inboundMessageDispatcher = inboundMessageDispatcher;
    this.multiPartPacketReassembler = multiPartPacketReassembler;
    this.udpUnicasterFactory = udpUnicasterFactory;
    this.announcementsReceivedCounter = announcementsReceivedCounter;
    this.tossedCounter = tossedCounter;
    this.duplicateReceivesCounter = duplicateReceivesCounter;
    this.multiPartChunksBytesReceivedAggregator = multiPartChunksBytesReceivedAggregator;
 }
Ejemplo n.º 5
0
 public UdpDispatcherImpl(Identity identity, UdpClient udpClient, DuplicateFilter duplicateFilter, PayloadSender payloadSender, AcknowledgementCoordinator acknowledgementCoordinator, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, MultiPartPacketReassembler multiPartPacketReassembler, IUdpUnicasterFactory udpUnicasterFactory, IAuditCounter announcementsReceivedCounter, IAuditCounter tossedCounter, IAuditCounter duplicateReceivesCounter, IAuditAggregator <int> multiPartChunksBytesReceivedAggregator)
 {
     this.identity                               = identity;
     this.udpClient                              = udpClient;
     this.duplicateFilter                        = duplicateFilter;
     this.payloadSender                          = payloadSender;
     this.acknowledgementCoordinator             = acknowledgementCoordinator;
     this.routingTable                           = routingTable;
     this.peerTable                              = peerTable;
     this.inboundMessageDispatcher               = inboundMessageDispatcher;
     this.multiPartPacketReassembler             = multiPartPacketReassembler;
     this.udpUnicasterFactory                    = udpUnicasterFactory;
     this.announcementsReceivedCounter           = announcementsReceivedCounter;
     this.tossedCounter                          = tossedCounter;
     this.duplicateReceivesCounter               = duplicateReceivesCounter;
     this.multiPartChunksBytesReceivedAggregator = multiPartChunksBytesReceivedAggregator;
 }
Ejemplo n.º 6
0
        public Task <ITransport> CreateAsync(MobOperations mobOperations, Identity identity, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, AuditService auditService)
        {
            // setup identity
            identity.Properties[UdpConstants.kUnicastPortIdentityPropertyKey] = configuration.UnicastReceiveEndpoint.Port.ToString();

            var duplicateFilter = new DuplicateFilter();

            duplicateFilter.Initialize();

            var inboundBytesAggregator  = auditService.GetAggregator <double>(DataSetNames.kInboundBytes);
            var outboundBytesAggregator = auditService.GetAggregator <double>(DataSetNames.kOutboundBytes);
            var inboundReceiveProcessDispatchLatencyAggregator = auditService.GetAggregator <double>(DataSetNames.kInboundProcessDispatchLatency);
            var resendsCounter                     = auditService.GetCounter(DataSetNames.kTotalResends);
            var resendsAggregator                  = auditService.GetAggregator <int>(DataSetNames.kMessageResends);
            var tossedCounter                      = auditService.GetCounter(DataSetNames.kTossed);
            var duplicatesReceivedCounter          = auditService.GetCounter(DataSetNames.kDuplicatesReceived);
            var announcementsReceivedCounter       = auditService.GetCounter(DataSetNames.kAnnouncementsReceived);
            var multiPartChunksSentCounter         = auditService.GetCounter(DataSetNames.kMultiPartChunksSent);
            var multiPartChunksReceivedAggregator  = auditService.GetAggregator <int>(DataSetNames.kMultiPartChunksBytesReceived);
            var outboundMessageRateLimitAggregator = auditService.GetAggregator <double>(DataSetNames.kOutboundMessageRateLimit);
            var sendQueueDepthAggregator           = auditService.GetAggregator <double>(DataSetNames.kSendQueueDepth);

            mobOperations.RegisterMob(new UdpDebugMob());

            var shutdownCts = new CancellationTokenSource();
            var acknowledgementCoordinator = new AcknowledgementCoordinator(identity);
            var udpUnicastScheduler        = SchedulerFactory.CreateWithCustomThreadPool($"Courier.Udp({identity.Id.ToShortString()}).Unicast");
            var sendReceiveBufferPool      = ObjectPool.CreateStackBacked(() => new byte[UdpConstants.kMaximumTransportSize]);
            var client        = UdpClient.Create(configuration, udpUnicastScheduler, sendReceiveBufferPool, inboundBytesAggregator, outboundBytesAggregator, inboundReceiveProcessDispatchLatencyAggregator);
            var payloadSender = new PayloadSender(client);
            var multiPartPacketReassembler = new MultiPartPacketReassembler();
            var udpUnicasterFactory        = new UdpUnicasterFactory(identity, client, acknowledgementCoordinator, sendReceiveBufferPool, resendsCounter, resendsAggregator, outboundMessageRateLimitAggregator, sendQueueDepthAggregator);
            var udpDispatcher = new UdpDispatcherImpl(identity, client, duplicateFilter, payloadSender, acknowledgementCoordinator, routingTable, peerTable, inboundMessageDispatcher, multiPartPacketReassembler, udpUnicasterFactory, announcementsReceivedCounter, tossedCounter, duplicatesReceivedCounter, multiPartChunksReceivedAggregator);

            multiPartPacketReassembler.SetUdpDispatcher(udpDispatcher);
            var announcer = new Announcer(identity, payloadSender, shutdownCts.Token);

            announcer.Initialize();
            var udpFacade      = new UdpFacade(client, udpDispatcher, shutdownCts);
            var udpBroadcaster = new UdpBroadcaster(identity, client);
            var transport      = new UdpTransport(udpBroadcaster, udpFacade);

            client.StartReceiving(udpDispatcher);

            return(Task.FromResult <ITransport>(transport));
        }
      public Task<ITransport> CreateAsync(MobOperations mobOperations, Identity identity, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher, AuditService auditService) {
         // setup identity
         identity.Properties[UdpConstants.kUnicastPortIdentityPropertyKey] = configuration.UnicastReceiveEndpoint.Port.ToString();

         var duplicateFilter = new DuplicateFilter();
         duplicateFilter.Initialize();

         var inboundBytesAggregator = auditService.GetAggregator<double>(DataSetNames.kInboundBytes);
         var outboundBytesAggregator = auditService.GetAggregator<double>(DataSetNames.kOutboundBytes);
         var inboundReceiveProcessDispatchLatencyAggregator = auditService.GetAggregator<double>(DataSetNames.kInboundProcessDispatchLatency);
         var resendsCounter = auditService.GetCounter(DataSetNames.kTotalResends);
         var resendsAggregator = auditService.GetAggregator<int>(DataSetNames.kMessageResends);
         var tossedCounter = auditService.GetCounter(DataSetNames.kTossed);
         var duplicatesReceivedCounter = auditService.GetCounter(DataSetNames.kDuplicatesReceived);
         var announcementsReceivedCounter = auditService.GetCounter(DataSetNames.kAnnouncementsReceived);
         var multiPartChunksSentCounter = auditService.GetCounter(DataSetNames.kMultiPartChunksSent);
         var multiPartChunksReceivedAggregator = auditService.GetAggregator<int>(DataSetNames.kMultiPartChunksBytesReceived);
         var outboundMessageRateLimitAggregator = auditService.GetAggregator<double>(DataSetNames.kOutboundMessageRateLimit);
         var sendQueueDepthAggregator = auditService.GetAggregator<double>(DataSetNames.kSendQueueDepth);

         mobOperations.RegisterMob(new UdpDebugMob());

         var shutdownCts = new CancellationTokenSource();
         var acknowledgementCoordinator = new AcknowledgementCoordinator(identity);
         var udpUnicastScheduler = SchedulerFactory.CreateWithCustomThreadPool($"Courier.Udp({identity.Id.ToShortString()}).Unicast");
         var sendReceiveBufferPool = ObjectPool.CreateStackBacked(() => new byte[UdpConstants.kMaximumTransportSize]);
         var client = UdpClient.Create(configuration, udpUnicastScheduler, sendReceiveBufferPool, inboundBytesAggregator, outboundBytesAggregator, inboundReceiveProcessDispatchLatencyAggregator);
         var payloadSender = new PayloadSender(client);
         var multiPartPacketReassembler = new MultiPartPacketReassembler();
         var udpUnicasterFactory = new UdpUnicasterFactory(identity, client, acknowledgementCoordinator, sendReceiveBufferPool, resendsCounter, resendsAggregator, outboundMessageRateLimitAggregator, sendQueueDepthAggregator);
         var udpDispatcher = new UdpDispatcherImpl(identity, client, duplicateFilter, payloadSender, acknowledgementCoordinator, routingTable, peerTable, inboundMessageDispatcher, multiPartPacketReassembler, udpUnicasterFactory, announcementsReceivedCounter, tossedCounter, duplicatesReceivedCounter, multiPartChunksReceivedAggregator);
         multiPartPacketReassembler.SetUdpDispatcher(udpDispatcher);
         var announcer = new Announcer(identity, payloadSender, shutdownCts.Token);
         announcer.Initialize();
         var udpFacade = new UdpFacade(client, udpDispatcher, shutdownCts);
         var udpBroadcaster = new UdpBroadcaster(identity, client);
         var transport = new UdpTransport(udpBroadcaster, udpFacade);
         client.StartReceiving(udpDispatcher);

         return Task.FromResult<ITransport>(transport);
      }