longer timeout, disconnect on zero quota
authorChristian Grothoff <christian@grothoff.org>
Tue, 9 Mar 2010 20:05:24 +0000 (20:05 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 9 Mar 2010 20:05:24 +0000 (20:05 +0000)
src/fs/test_gnunet_service_fs_p2p.c
src/transport/gnunet-service-transport.c

index 7b6a765d4429b5cb8ed66af9f296a8ffe2b0f3d4..410666deabb5c91029354991d19db93ab0596025 100644 (file)
@@ -36,7 +36,7 @@
 /**
  * How long until we give up on transmitting the message?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
 
 #define NUM_DAEMONS 2
 
@@ -46,6 +46,8 @@ static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS];
 
 static struct GNUNET_SCHEDULER_Handle *sched;
 
+static int ok;
+
 
 static void
 do_stop (void *cls,
@@ -54,10 +56,18 @@ do_stop (void *cls,
   GNUNET_FS_TEST_daemons_stop (sched,
                               NUM_DAEMONS,
                               daemons);
-  GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Finished download, shutting down\n",
-             (unsigned long long) FILESIZE);
+  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Finished download, shutting down\n",
+                 (unsigned long long) FILESIZE);
+    }
+  else
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Timeout during download, shutting down with error\n");
+      ok = 1;
+    }
 }
 
 
@@ -156,7 +166,7 @@ main (int argc, char *argv[])
                       argvx, "test-gnunet-service-fs-p2p",
                      "nohelp", options, &run, NULL);
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
-  return 0;
+  return ok;
 }
 
 /* end of test_gnunet_service_fs_p2p.c */
index 04dbf9f2079fdf000d9ab4c1cd259854e83d064b..6c0a9415cab413df1b6a99c26f0b0440e8869842 100644 (file)
@@ -3009,6 +3009,8 @@ handle_set_quota (void *cls,
 #endif
   GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker,
                                         qsm->quota);
+  if (0 == ntohl (qsm->quota.value__)) 
+    disconnect_neighbour (n, GNUNET_NO);    
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }