X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_misc.c;fp=src%2Fprotocol_misc.c;h=18ff13c8de4bfb05a101666af22f2246f209d1a2;hp=8f56aee50aff918a20f6a0791aa0c9acd7323a6b;hb=f80bf14f28925df6eaa56f3ed77adaf418ab9890;hpb=35e87b903e08fc51975a8cc97f06251d5153a424 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))