コード例 #1
0
ファイル: RdmReliableSocket.cs プロジェクト: ming-hai/ACN
        public void SendRdm(RdmPacket packet, RdmEndPoint targetAddress, UId targetId, UId sourceId)
        {
            //Queue this packet for sending.
            RegisterTransaction(packet, targetAddress, targetId);

            // socket.SendRdm(packet, targetAddress, targetId, sourceId);
        }
コード例 #2
0
 public Transaction(int transactionId, RdmPacket packet, RdmEndPoint address, UId id)
 {
     Id = transactionId;
     TransactionNumber = (byte)(transactionId % 255);
     Packet            = packet;
     TargetAddress     = address;
     TargetId          = id;
     Attempts          = 0;
     LastAttempt       = DateTime.MinValue;
 }
コード例 #3
0
        public void SendRdm(RdmPacket packet, RdmEndPoint targetAddress, UId targetId)
        {
            if (BlockRDM)
            {
                return;
            }

            //Queue this packet for sending.
            RegisterTransaction(packet, targetAddress, targetId);

            //socket.SendRdm(packet, targetAddress, targetId);
        }
コード例 #4
0
        private void RegisterTransaction(RdmPacket packet, RdmEndPoint address, UId id)
        {
            lock (transactionQueue)
            {
                if (packet.Header.Command == RdmCommands.Get || packet.Header.Command == RdmCommands.Set)
                {
                    int         transactionId = AllocateTransactionNumber();
                    Transaction transaction   = new Transaction(transactionId, packet, address, id);
                    transactionQueue.Add(transactionId, transaction);
                    packet.Header.TransactionNumber = transaction.TransactionNumber;

                    if (transactionQueue.Count == 1 && retryTimer != null)
                    {
                        retryTimer.Change(TransmitInterval, TimeSpan.Zero);
                    }

                    TransactionsStarted++;
                }
            }
        }