X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_misc.c;h=b8d2f67d39c6158484b89bc1ae91686c3faeaca8;hb=f1fec466e232c00c668422014029dce9114d3add;hp=02e3859810d2d9f76880abca5be513d852666767;hpb=5a132550deb58473285e5f91705d286aef47be71;p=tinc 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))