gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10028 - in gnunet/src: hostlist peerinfo transport


From: gnunet
Subject: [GNUnet-SVN] r10028 - in gnunet/src: hostlist peerinfo transport
Date: Sun, 17 Jan 2010 22:07:12 +0100

Author: grothoff
Date: 2010-01-17 22:07:12 +0100 (Sun, 17 Jan 2010)
New Revision: 10028

Modified:
   gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
   gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
   gnunet/src/peerinfo/peerinfo_api.c
   gnunet/src/transport/transport.h
   gnunet/src/transport/transport_api.c
Log:
fixes

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-01-17 13:11:14 UTC 
(rev 10027)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-01-17 21:07:12 UTC 
(rev 10028)
@@ -62,10 +62,16 @@
 static void
 clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_TRANSPORT_disconnect (p1.th);
-  p1.th = NULL;
-  GNUNET_TRANSPORT_disconnect (p2.th);
-  p2.th = NULL;
+  if (p1.th != NULL)
+    {
+      GNUNET_TRANSPORT_disconnect (p1.th);
+      p1.th = NULL;
+    }
+  if (p2.th != NULL)
+    {
+      GNUNET_TRANSPORT_disconnect (p2.th);
+      p2.th = NULL;
+    }
   GNUNET_SCHEDULER_shutdown (sched);
 }
 
@@ -99,13 +105,16 @@
     return;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Peers connected, shutting down.\n");
-  GNUNET_assert (ok == 4);
   ok = 0;
-  GNUNET_SCHEDULER_cancel (sched,
-                          timeout_task);
-  timeout_task = GNUNET_SCHEDULER_NO_TASK;
-  GNUNET_SCHEDULER_add_now (sched,
-                           &clean_up, NULL);
+  if (timeout_task != GNUNET_SCHEDULER_NO_TASK)
+    {
+      GNUNET_SCHEDULER_cancel (sched,
+                              timeout_task);
+      timeout_task = GNUNET_SCHEDULER_NO_TASK;
+    }
+  GNUNET_SCHEDULER_add_delayed (sched,
+                               GNUNET_TIME_UNIT_MINUTES,
+                               &clean_up, NULL);
 }
 
 
@@ -121,8 +130,6 @@
     return;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Received HELLO, starting hostlist service.\n");
-  GNUNET_assert ( (ok >= 2) && (ok <= 3) );
-  ok++;
   GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL);
 }
 

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf  2010-01-17 
13:11:14 UTC (rev 10027)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf  2010-01-17 
21:07:12 UTC (rev 10028)
@@ -8,7 +8,7 @@
 [transport]
 PORT = 12965
 PLUGINS = tcp
-#DEBUG = YES
+DEBUG = YES
 
 [arm]
 PORT = 12966
@@ -36,6 +36,7 @@
 HTTPPORT = 12980
 SERVERS = http://localhost:12981/
 OPTIONS = -b -p
+DEBUG = YES
 #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
 
 [topology]

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf  2010-01-17 
13:11:14 UTC (rev 10027)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf  2010-01-17 
21:07:12 UTC (rev 10028)
@@ -8,7 +8,7 @@
 [transport]
 PORT = 22965
 PLUGINS = tcp
-#DEBUG = YES
+DEBUG = YES
 
 [arm]
 PORT = 22966
@@ -36,6 +36,7 @@
 HTTPPORT = 12981
 SERVERS = http://localhost:12980/
 OPTIONS = -b -p
+DEBUG = YES
 #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
 
 [topology]

Modified: gnunet/src/peerinfo/peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/peerinfo_api.c  2010-01-17 13:11:14 UTC (rev 10027)
+++ gnunet/src/peerinfo/peerinfo_api.c  2010-01-17 21:07:12 UTC (rev 10028)
@@ -49,10 +49,12 @@
 
   if (buf == NULL)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+#if DEBUG_PEERINFO
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   _
                   ("Failed to transmit message of type %u to `%s' service.\n"),
                   ntohs (msg->type), "peerinfo");
+#endif
       GNUNET_free (msg);
       GNUNET_CLIENT_disconnect (cc->client);
       GNUNET_free (cc);
@@ -112,7 +114,7 @@
   GNUNET_CLIENT_notify_transmit_ready (client,
                                        ntohs (pam->header.size),
                                        ADD_PEER_TIMEOUT, 
-                                      GNUNET_YES,
+                                      GNUNET_NO,
                                       &copy_and_free, cc);
 }
 

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2010-01-17 13:11:14 UTC (rev 10027)
+++ gnunet/src/transport/transport.h    2010-01-17 21:07:12 UTC (rev 10028)
@@ -27,7 +27,7 @@
 #include "gnunet_time_lib.h"
 #include "gnunet_transport_service.h"
 
-#define DEBUG_TRANSPORT GNUNET_NO
+#define DEBUG_TRANSPORT GNUNET_YES
 
 /**
  * For how long do we allow unused bandwidth

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2010-01-17 13:11:14 UTC (rev 
10027)
+++ gnunet/src/transport/transport_api.c        2010-01-17 21:07:12 UTC (rev 
10028)
@@ -378,7 +378,7 @@
   if (buf == NULL)
     {
 #if DEBUG_TRANSPORT
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Could not transmit to transport service, cancelling pending 
requests\n");
 #endif
       th = h->connect_ready_head;
@@ -398,7 +398,8 @@
        }
       GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL));
       GNUNET_free (th);
-      if (h->connect_ready_head != NULL) schedule_transmission (h); /* FIXME: 
is this ok? */
+      if (h->connect_ready_head != NULL) 
+       schedule_transmission (h); /* FIXME: is this ok? */
       return 0;
     } 
 #if DEBUG_TRANSPORT
@@ -409,7 +410,8 @@
   ret = 0;
   h->network_handle = NULL;
   h->transmission_scheduled = GNUNET_NO;
-  do
+  while ((h->connect_ready_head != NULL) &&
+         (h->connect_ready_head->notify_size <= size))
     {
       th = h->connect_ready_head;
       if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
@@ -433,8 +435,6 @@
         n->last_sent += ret;
       size -= ret;
     }
-  while ((h->connect_ready_head != NULL) &&
-         (h->connect_ready_head->notify_size <= size));
   if (h->connect_ready_head != NULL)
     schedule_transmission (h);
 #if DEBUG_TRANSPORT
@@ -1498,6 +1498,16 @@
   while (NULL != (n = handle->neighbours))
     {
       handle->neighbours = n->next;
+      if (NULL != (th = n->transmit_handle))
+       {
+         if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
+           {
+             GNUNET_SCHEDULER_cancel (handle->sched, th->notify_delay_task);
+             th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
+           }
+         th->notify (th->notify_cls, 0, NULL);
+         GNUNET_free (th);
+       }
       GNUNET_free (n);
     }
   while (NULL != (hwl = handle->hwl_head))





reply via email to

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