X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fprotocol_misc.c;h=b8d2f67d39c6158484b89bc1ae91686c3faeaca8;hb=075e6828a7533e7daa790225f17aa6bb39703278;hp=02e3859810d2d9f76880abca5be513d852666767;hpb=08aabbf9317806bc50a9a6693ca866c8936ce26b;p=meshlink 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))