]> git.meshlink.io Git - meshlink/blobdiff - src/protocol.c
Replace rand() by xoshiro256** with per-mesh state.
[meshlink] / src / protocol.c
index 3886e357a83b91a7349d80d1314d4ea601282600..fa1dc13786b4a30cb02cfe079a2a06b37ecf8925 100644 (file)
@@ -209,7 +209,7 @@ static void age_past_requests(event_loop_t *loop, void *data) {
 
        if(left) {
                timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timeval) {
-                       10, rand() % 100000
+                       10, prng(mesh, TIMER_FUDGE)
                });
        }
 }
@@ -230,7 +230,7 @@ bool seen_request(meshlink_handle_t *mesh, const char *request) {
 
                if(!mesh->past_request_tree->head) {
                        timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timeval) {
-                               10, rand() % 100000
+                               10, prng(mesh, TIMER_FUDGE)
                        });
                }