X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fprotocol_misc.c;fp=src%2Fprotocol_misc.c;h=b8d2f67d39c6158484b89bc1ae91686c3faeaca8;hp=02e3859810d2d9f76880abca5be513d852666767;hb=075e6828a7533e7daa790225f17aa6bb39703278;hpb=9b129c07e273ae113f3c67a9feeee82e8146f3a1 diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 02e38598..b8d2f67d 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -154,7 +154,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->buffer->output->off / (double)maxoutbufsize - 1 > drand48()) + if(2.0 * c->buffer->output->off / (float)maxoutbufsize - 1 > (float)rand()/(float)RAND_MAX) return true; if(!send_request(c, "%d %hd", PACKET, packet->len))