Esempio n. 1
0
        // Checks Vno if necessary then routes message.
        public void DispatchLinkPacket(PacketParser p)
        {
            // TODO: Check packet is for us first.

            // TODO: IoNetIf.activityTimeout=Primitives.GetBabelMilliTicker() + LinkMonitor.CONX_ACTIVITY_TIMEOUT;
            IoNetIf.baudTimeout = Primitives.GetBabelMilliTicker() + LinkMonitor.BAUD_RATE_TIMEOUT; // Reset timer after input from specific sender.

            if ((IoNetIf.duplexNumWaiting > 0) && (IoNetIf.duplexNumWaiting != 0xffu))
            {
                IoNetIf.duplexNumWaiting--; //DUX.
            }
            // Check vno sequence.
            if (p.Pid == ProtocolConstants.PID_GENERAL_V)
            {
                byte arg = p.CurrentPacket.arg();
                if (CheckOrderMissingQ(arg, true))
                {
                    // It's a resent packet, check missingQ & remove.
                    if (!IoNetIf.LinkMissingQueue.RemoveFirstOccurrence(arg))
                    {
                        // Not on Q, so ignore: it was sent ok previously.
                        // Keep buffer for next msg.
                        //IoBuffersFreeHeap.Push(IoIndex);
                        //IoIndex=-1;
                        return;
                    }
                }
            }
            // Dispatch message.
            if (Settings.DebugLevel > 6)
            {
                Log.d(TAG, "Dispatching:" + p.IoIndex + ".");
            }
            ++NumMessagesRead;
            Router.RouteMessage(Manager, p.IoIndex);
            p.IoIndex = -1;
        }