summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authormichele papalini <micpapal@cisco.com>2020-02-05 17:19:15 +0100
committermichele papalini <micpapal@cisco.com>2020-02-05 17:19:15 +0100
commitacc777f02b93244d4d85446e890e94dbff2d6ada (patch)
tree80557660dfb67afa84e5dcb3a91f3e433fd87627 /libtransport
parent37fd13f62206f9539b3102a2ceba2f96e1be2538 (diff)
[HICN-503] correctly compute drop probability in RAAQM
Signed-off-by: michele papalini <micpapal@cisco.com> Change-Id: I1b74a88c4d46aae178599f43ac6f223b29d4dfc5
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/protocols/raaqm.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc
index 21a59bc9a..a57eb7cd9 100644
--- a/libtransport/src/hicn/transport/protocols/raaqm.cc
+++ b/libtransport/src/hicn/transport/protocols/raaqm.cc
@@ -567,7 +567,8 @@ void RaaqmTransportProtocol::RAAQM() {
// Change drop probability according to RTT statistics
cur_path_->updateDropProb();
- if (std::rand() % 10000 <= cur_path_->getDropProb() * 10000) {
+ double coin = ((double) rand() / (RAND_MAX));
+ if (coin <= cur_path_->getDropProb()) {
decreaseWindow();
}
}