gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3903 - in GNUnet/src: applications/advertising transports


From: grothoff
Subject: [GNUnet-SVN] r3903 - in GNUnet/src: applications/advertising transports util/network util/os
Date: Sat, 9 Dec 2006 19:47:22 -0800 (PST)

Author: grothoff
Date: 2006-12-09 19:47:17 -0800 (Sat, 09 Dec 2006)
New Revision: 3903

Modified:
   GNUnet/src/applications/advertising/bootstrap.c
   GNUnet/src/transports/tcp_old.c
   GNUnet/src/util/network/io.c
   GNUnet/src/util/os/statuscalls.c
Log:
more checking for load calls

Modified: GNUnet/src/applications/advertising/bootstrap.c
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.c     2006-12-09 12:19:12 UTC 
(rev 3902)
+++ GNUnet/src/applications/advertising/bootstrap.c     2006-12-10 03:47:17 UTC 
(rev 3903)
@@ -143,7 +143,7 @@
   char * data;
 
   now = get_time();
-  if (coreAPI->forAllConnectedNodes(NULL, NULL) >= 4) {
+  if (coreAPI->forAllConnectedNodes(NULL, NULL) >= 3) {
     /* still change delta and lastTest; even
        if the peer _briefly_ drops below 4
        connections, we don't want it to immediately

Modified: GNUnet/src/transports/tcp_old.c
===================================================================
--- GNUnet/src/transports/tcp_old.c     2006-12-09 12:19:12 UTC (rev 3902)
+++ GNUnet/src/transports/tcp_old.c     2006-12-10 03:47:17 UTC (rev 3903)
@@ -602,7 +602,9 @@
   
   setBlocking(s, YES);
 
-  if (*sent == SYSERR && (errno == EWOULDBLOCK || errno == EAGAIN))
+  if ( (*sent == SYSERR) && 
+       ( (errno == EWOULDBLOCK) 
+        || (errno == EAGAIN) ) )
     return NO;
   else if ( (*sent < 0) || (*sent > max) )
     return SYSERR;

Modified: GNUnet/src/util/network/io.c
===================================================================
--- GNUnet/src/util/network/io.c        2006-12-09 12:19:12 UTC (rev 3902)
+++ GNUnet/src/util/network/io.c        2006-12-10 03:47:17 UTC (rev 3903)
@@ -215,7 +215,8 @@
         (errno == EINTR) &&
         (0 != (nc & NC_IgnoreInt)) )
       continue;
-    if (ret == (size_t) -1) {
+    if ( (ret == (size_t) -1) ||
+        (ret > max - pos) ) {
       if (errno == EINTR) {
        *read = pos;
        return YES;
@@ -290,7 +291,8 @@
         (errno == EINTR) &&
         (0 != (nc & NC_IgnoreInt)) )
       continue;
-    if (ret == (size_t) -1) {
+    if ( (ret == (size_t) -1) ||
+        (ret > max - pos) ) {
       if (errno == EINTR) {
        *read = pos;
        return YES;
@@ -362,7 +364,8 @@
         (errno == EINTR) &&
         (0 != (nc & NC_IgnoreInt)) )
       continue;
-    if (ret == (size_t) -1) {
+    if ( (ret == (size_t) -1) ||
+        (ret > max - pos) ) {
       if (errno == EINTR) {
        *sent = pos;
        return YES;
@@ -438,7 +441,8 @@
         (errno == EINTR) &&
         (0 != (nc & NC_IgnoreInt)) )
       continue;
-    if (ret == (size_t) -1) {
+    if ( (ret == (size_t) -1) ||
+        (ret > max - pos) ) {
       if (errno == EINTR) {
        *sent = pos;
        return YES;

Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c    2006-12-09 12:19:12 UTC (rev 3902)
+++ GNUnet/src/util/os/statuscalls.c    2006-12-10 03:47:17 UTC (rev 3903)
@@ -60,8 +60,11 @@
 #define PROC_NET_DEV "/proc/net/dev"
 
 typedef struct {
+
   char * name;
+
   unsigned long long last_in;
+
   unsigned long long last_out;
 } NetworkStats;
 
@@ -129,7 +132,7 @@
 
 void os_network_monitor_notify_transmission(struct LoadMonitor * monitor,
                                            NetworkDirection dir,
-                                           unsigned long long delta) {
+                                           unsigned long long delta) {  
   MUTEX_LOCK(monitor->statusMutex);
   if (dir == Download)
     monitor->globalTrafficBetweenProc.last_in += delta;
@@ -281,7 +284,7 @@
   basic = GC_get_configuration_value_yesno(cfg,
                                           "LOAD",
                                           "BASICLIMITING",
-                                          NO);
+                                          YES);
   if (basic == SYSERR)
     return SYSERR;
   if (-1 == GC_get_configuration_value_string(cfg,
@@ -330,6 +333,12 @@
     monitor->ifcs[i].last_in = 0;
     monitor->ifcs[i].last_out = 0;
   }
+  monitor->upload_info.have_last = NO;
+  monitor->upload_info.lastCall = 0;
+  monitor->upload_info.overload = 0;
+  monitor->download_info.have_last = NO;
+  monitor->download_info.lastCall = 0;
+  monitor->download_info.overload = 0;
   FREE(interfaces);
   monitor->useBasicMethod = basic;
   GC_get_configuration_value_number(cfg,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]