[PATCH] Fix handling of macMaxCSMABackoffs and macMaxFrameRetries

16 views
Skip to first unread message

Florian Meier

unread,
Aug 31, 2014, 3:05:06 AM8/31/14
to omn...@googlegroups.com
Both parameters were off by one, since txAttempts as well as
NB start with 0.
---

Since I don't know which repository is the current one (Sourceforge, Github?)
or if MiXiM is actually still supported, I submit the patch via the mailing list.

I am not 100% sure about this patch, but when I mentally step through the code,
the values are always off by one. Is there anything that I have overlooked?

src/modules/mac/csma.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/mac/csma.cc b/src/modules/mac/csma.cc
index 29083fa..a8a492e 100644
--- a/src/modules/mac/csma.cc
+++ b/src/modules/mac/csma.cc
@@ -358,7 +358,7 @@ void csma::updateStatusCCA(t_mac_event event, cMessage *msg) {
//BE = std::min(BE+1, macMaxBE);

// decide if we go for another backoff or if we drop the frame.
- if(NB> macMaxCSMABackoffs) {
+ if(NB> macMaxCSMABackoffs - 1) {
// drop the frame
debugEV << "Tried " << NB << " backoffs, all reported a busy "
<< "channel. Dropping the packet." << endl;
@@ -501,7 +501,7 @@ void csma::updateStatusWaitAck(t_mac_event event, cMessage *msg) {
}

void csma::manageMissingAck(t_mac_event /*event*/, cMessage */*msg*/) {
- if (txAttempts < macMaxFrameRetries + 1) {
+ if (txAttempts < macMaxFrameRetries) {
// increment counter
txAttempts++;
debugEV<< "I will retransmit this packet (I already tried "
--
1.9.1
Reply all
Reply to author
Forward
0 new messages