From f80bf14f28925df6eaa56f3ed77adaf418ab9890 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 14 Sep 2009 23:28:28 +0200 Subject: [PATCH] Also do not use drand48(), it is not available on Windows. --- src/net.c | 1 - src/protocol_misc.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/net.c b/src/net.c index 3cf1773d..c893f1e4 100644 --- a/src/net.c +++ b/src/net.c @@ -366,7 +366,6 @@ int main_loop(void) last_graph_dump = now; srand(now); - srand48(now); running = true; diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 8f56aee5..18ff13c8 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -158,7 +158,7 @@ bool send_tcppacket(connection_t *c, vpn_packet_t *packet) /* If there already is a lot of data in the outbuf buffer, discard this packet. We use a very simple Random Early Drop algorithm. */ - if(2.0 * c->outbuflen / (double)maxoutbufsize - 1 > drand48()) + if(2.0 * c->outbuflen / (float)maxoutbufsize - 1 > (float)rand()/(float)RAND_MAX) return true; if(!send_request(c, "%d %hd", PACKET, packet->len)) -- 2.20.1