]> git.sesse.net Git - jam/commitdiff
Parametrize out the update frequency.
authorsgunderson@bigfoot.com <>
Tue, 13 Feb 2007 21:31:46 +0000 (22:31 +0100)
committersgunderson@bigfoot.com <>
Tue, 13 Feb 2007 21:31:46 +0000 (22:31 +0100)
jam.c

diff --git a/jam.c b/jam.c
index 5faf0379d4b7eb13299dd48595641d935e6e409a..1f2aedcf5d4d1855b3bade5776c997dbc2238a64 100644 (file)
--- a/jam.c
+++ b/jam.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 
 unsigned short port = 2007;
+unsigned update_frequency = 1048576;
 
 struct in_addr *destinations = NULL;
 unsigned num_destinations = 0;
@@ -263,7 +264,7 @@ void *sender_worker(void *arg)
 
                        // update the central counter after every 1MB (8ms
                        // at gigabit speeds, should be enough) of sent data
-                       if (bytes_sent > 1048576) {
+                       if (bytes_sent > update_frequency) {
                                pthread_mutex_lock(&send_mutex);
                                total_bytes_sent += bytes_sent;
                                pthread_mutex_unlock(&send_mutex);
@@ -307,7 +308,7 @@ void *receiver_worker(void *arg)
 
                // update the central counter after every 1MB (8ms
                // at gigabit speeds, should be enough) of received data
-               if (bytes_received > 1048576) {
+               if (bytes_received > update_frequency) {
                        pthread_mutex_lock(&receive_mutex);
                        total_bytes_received += bytes_received;
                        pthread_mutex_unlock(&receive_mutex);