private void processAckTimer(PEQTimerAck timer) { List<PEQTableEntryMessageAck> killList = new List<PEQTableEntryMessageAck>(); VarID sinkID = new VarID(_NUM_ID_BYTES); foreach (PEQTableEntryMessageAck entry in _tableAck) { if (entry._SequenceNumber == timer._AckInfo._SequenceNumber) { // Add entry to list for deletion killList.Add(entry); bool search = false; // Check neighbor - if `holds current route?` Then `Search.` foreach (PEQTableEntryRouting route in _tableRouting) { if (route._DestinationID == entry._DestinationID) if (route._Valid) { route._Valid = false; search = true; sinkID = route._SinkID; } } // Check neighbor subscription entries foreach (PEQTableEntrySubscription subscription in _tableSubscription) { if (subscription._DestinationID == entry._DestinationID) { subscription._Valid = false; search = true; } } if (search) startSearch(sinkID, entry._DataMessage); // Delete neighbor _tableNeighbor.Remove(entry._DestinationID); } } // Clear the ack list of all matched entries. foreach (PEQTableEntryMessageAck entry in killList) _tableAck.Remove(entry); }
private void expectAck(PEQMessage msg) { // Add the ACK info to the ACK Table and create a timer event to kill // the neighbor entry upon ACK failure. PEQTableEntryMessageAck ackEntry = new PEQTableEntryMessageAck(msg._SequenceNumber, msg._DestinationID, msg); _tableAck.Add(ackEntry); PEQTimerAck ackTimer = new PEQTimerAck(_eventManager.CurrentClock + _physicalProcessor.MaximumRange * _TIMER_ACK / _physicalProcessor.PropagationSpeed, this, ackEntry); _eventManager.AddEvent(ackTimer); }