check return values, cancel timeout task
authorChristian Grothoff <christian@grothoff.org>
Fri, 27 May 2011 13:32:42 +0000 (13:32 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 27 May 2011 13:32:42 +0000 (13:32 +0000)
src/fs/fs_test_lib_data.conf
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_push.c

index bd1c61cb6b65d50f4199c92efe75f893af2236b8..00654c73d57ce78a745720ba136601362c4ad31f 100644 (file)
@@ -55,8 +55,8 @@ HOSTNAME = localhost
 CONTENT_CACHING = NO
 CONTENT_PUSHING = NO
 #DEBUG = YES
-#PREFIX = valgrind --tool=memcheck --leak-check=yes --trace-children=yes
-#BINARY = /home/grothoff/bin/gnunet-service-fs
+PREFIX = valgrind --tool=memcheck --leak-check=yes --trace-children=yes
+BINARY = /home/grothoff/bin/gnunet-service-fs
 #PREFIX = xterm -e gdb -x cmd --args 
 
 [testing]
index 519e897c5669ed37f1e46c59ffc0952d32b462c0..2d8c879b8f3886330cfd7f78346fd3394b19d19c 100644 (file)
@@ -417,6 +417,7 @@ peer_transmit_ready_cb (void *cls,
                        void *buf)
 {
   struct GSF_PeerTransmitHandle *pth = cls;
+  struct GSF_PeerTransmitHandle *pos;
   struct GSF_ConnectedPeer *cp;
   size_t ret;
   
@@ -445,9 +446,13 @@ peer_transmit_ready_cb (void *cls,
                      GNUNET_TIME_absolute_get_duration (pth->transmission_request_start_time).rel_value);
   ret = pth->gmc (pth->gmc_cls, 
                  size, buf);
+  GNUNET_assert (NULL == pth->cth);
+  for (pos = cp->pth_head; pos != NULL; pos = pos->next)
+    {
+      GNUNET_assert (pos != pth);
+      schedule_transmission (pos);
+    }
   GNUNET_free (pth);
-  for (pth = cp->pth_head; pth != NULL; pth = pth->next)
-    schedule_transmission (pth);
   return ret;
 }
 
@@ -1497,6 +1502,11 @@ GSF_peer_disconnect_handler_ (void *cls,
          GNUNET_CORE_notify_transmit_ready_cancel (pth->cth);
          pth->cth = NULL;
        }
+      if (pth->timeout_task != GNUNET_SCHEDULER_NO_TASK)
+       {
+         GNUNET_SCHEDULER_cancel (pth->timeout_task);
+         pth->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+       }
       GNUNET_CONTAINER_DLL_remove (cp->pth_head,
                                   cp->pth_tail,
                                   pth);
index e4ba2d7639c11c32f4e6a9204dbbdcab2205cf8f..339f98616e598336089d6fa437ef6e0ae74d0a0d 100644 (file)
@@ -594,7 +594,8 @@ gather_migration_blocks (void *cls,
                                                     0, UINT_MAX,
                                                     GNUNET_TIME_UNIT_FOREVER_REL,
                                                     &process_migration_content, NULL);
-      GNUNET_assert (mig_qe != NULL);
+      if (NULL == mig_qe)
+       consider_gathering ();
     }
 }