From 37630803d1fcb52fdf7ad5f0afcb0ed15c7ba851 Mon Sep 17 00:00:00 2001 From: matlin Date: Sun, 1 Sep 2024 10:55:46 +0200 Subject: [PATCH] Fixed packets not being sent up by CSMA ALOHA on listen state --- .../DESERT/data_link/uw-csma-aloha/uw-csma-aloha.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DESERT_Framework/DESERT/data_link/uw-csma-aloha/uw-csma-aloha.cpp b/DESERT_Framework/DESERT/data_link/uw-csma-aloha/uw-csma-aloha.cpp index e6b3fe40..24d2dc95 100644 --- a/DESERT_Framework/DESERT/data_link/uw-csma-aloha/uw-csma-aloha.cpp +++ b/DESERT_Framework/DESERT/data_link/uw-csma-aloha/uw-csma-aloha.cpp @@ -982,6 +982,18 @@ CsmaAloha::stateRxData(Packet *data_pkt) stateCheckListenExpired(); } break; + case CSMA_STATE_LISTEN: { + hdr_cmn *ch = hdr_cmn::access(data_pkt); + ch->size() = ch->size() - HDR_size; + incrDataPktsRx(); + sendUp(data_pkt); + + if (ack_mode == CSMA_ACK_MODE) + stateTxAck(dst_addr); + else + stateCheckListenExpired(); + } break; + case CSMA_STATE_RX_BACKOFF: { hdr_cmn *ch = hdr_cmn::access(data_pkt); ch->size() = ch->size() - HDR_size;