]> git.meshlink.io Git - meshlink/blobdiff - src/protocol_misc.c
Merge branch 'master' into 1.1
[meshlink] / src / protocol_misc.c
index 02e3859810d2d9f76880abca5be513d852666767..b8d2f67d39c6158484b89bc1ae91686c3faeaca8 100644 (file)
@@ -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))