Ejemplo n.º 1
0
 public void HandleAckMessage(AckMessage ackMessage)
 {
     OutboundMessage outboundMessage = null;
     if (outboundMessagesBySequence.TryGetValue(ackMessage.AckedSequenceNumber, out outboundMessage))
     {
         outboundMessages.Remove(outboundMessage);
         outboundMessagesBySequence.Remove(ackMessage.AckedSequenceNumber);
         outboundMessagePool.Push(outboundMessage);
     }
     if (isResetPending && outboundMessages.FirstOrDefault(x => x.NeedsAck) == null)
     {
         if (IsVerbose)
             NeutrinoConfig.Log(node.Name + " drained all outbound - resetting sequence and sending queued");
         isResetPending = false;
         nextSequence = 0;
         foreach (byte[] buffer in pendingResetOutboundMessages)
             Enqueue(msgFactory.Read(buffer));
         pendingResetOutboundMessages.Clear();
     }
 }
Ejemplo n.º 2
0
 internal void Init(Node node, Socket socket, IPAddress address, int port, string nickname)
 {
     this.node = node;
     msgFactory = node.MessageFactory;
     Nickname = nickname;
     this.endpoint = new IPEndPoint(address, port);
     outboundQueue = new OutboundQueue(node, this.endpoint, socket);
     ackMessage = msgFactory.Get<AckMessage>();
     previousActivityTimeTicks = Environment.TickCount;
 }