Also do not use drand48(), it is not available on Windows.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 14 Sep 2009 21:28:28 +0000 (23:28 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 14 Sep 2009 21:28:28 +0000 (23:28 +0200)
src/net.c
src/protocol_misc.c

index 3cf1773d578a70b99daa3217915d175906c1ee46..c893f1e41c07c5027eda0b9c2cfca33932007fd0 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -366,7 +366,6 @@ int main_loop(void)
        last_graph_dump = now;
        
        srand(now);
-       srand48(now);
 
        running = true;
 
index 8f56aee50aff918a20f6a0791aa0c9acd7323a6b..18ff13c8de4bfb05a101666af22f2246f209d1a2 100644 (file)
@@ -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))