gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8694 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r8694 - gnunet/src/core
Date: Tue, 14 Jul 2009 16:38:23 -0600

Author: grothoff
Date: 2009-07-14 16:38:23 -0600 (Tue, 14 Jul 2009)
New Revision: 8694

Modified:
   gnunet/src/core/core.h
   gnunet/src/core/test_core_api.c
   gnunet/src/core/test_core_api_peer1.conf
   gnunet/src/core/test_core_api_peer2.conf
Log:
terminate with error if message fails to come back instead of hanging

Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h      2009-07-14 22:36:11 UTC (rev 8693)
+++ gnunet/src/core/core.h      2009-07-14 22:38:23 UTC (rev 8694)
@@ -29,12 +29,12 @@
 /**
  * General core debugging.
  */
-#define DEBUG_CORE GNUNET_NO
+#define DEBUG_CORE GNUNET_YES
 
 /**
  * Debugging interaction core-clients.
  */
-#define DEBUG_CORE_CLIENT GNUNET_NO
+#define DEBUG_CORE_CLIENT GNUNET_YES
 
 /**
  * Definition of bits in the InitMessage's options field that specify

Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c     2009-07-14 22:36:11 UTC (rev 8693)
+++ gnunet/src/core/test_core_api.c     2009-07-14 22:38:23 UTC (rev 8694)
@@ -34,7 +34,7 @@
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_transport_service.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 #define START_ARM GNUNET_YES
 
@@ -89,6 +89,20 @@
 
 
 static void
+terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_break (0);
+  GNUNET_CORE_disconnect (p1.ch);
+  GNUNET_CORE_disconnect (p2.ch);
+  GNUNET_TRANSPORT_disconnect (p1.th);
+  GNUNET_TRANSPORT_disconnect (p2.th);
+  GNUNET_ARM_stop_service ("core", p1.cfg, sched, TIMEOUT, NULL, NULL);
+  GNUNET_ARM_stop_service ("core", p2.cfg, sched, TIMEOUT, NULL, NULL);
+  ok = 42;
+}
+
+
+static void
 connect_notify (void *cls,
                 const struct GNUNET_PeerIdentity *peer)
 {
@@ -143,6 +157,9 @@
 }
 
 
+static GNUNET_SCHEDULER_TaskIdentifier err_task;
+
+
 static int
 process_mtype (void *cls,
                const struct GNUNET_PeerIdentity *peer,
@@ -152,6 +169,7 @@
               "Receiving message from `%4s'.\n", GNUNET_i2s (peer));
   GNUNET_assert (ok == 5);
   OKPP;
+  GNUNET_SCHEDULER_cancel (sched, err_task);
   GNUNET_SCHEDULER_add_delayed (sched,
                                 GNUNET_NO,
                                 GNUNET_SCHEDULER_PRIORITY_KEEP,
@@ -180,6 +198,13 @@
   m = (struct GNUNET_MessageHeader *) buf;
   m->type = htons (MTYPE);
   m->size = htons (sizeof (struct GNUNET_MessageHeader));
+  err_task = 
+    GNUNET_SCHEDULER_add_delayed (sched,
+                                 GNUNET_NO,
+                                 GNUNET_SCHEDULER_PRIORITY_KEEP,
+                                 GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
+                                 GNUNET_TIME_UNIT_MINUTES, 
&terminate_task_error, NULL);
+
   return sizeof (struct GNUNET_MessageHeader);
 }
 

Modified: gnunet/src/core/test_core_api_peer1.conf
===================================================================
--- gnunet/src/core/test_core_api_peer1.conf    2009-07-14 22:36:11 UTC (rev 
8693)
+++ gnunet/src/core/test_core_api_peer1.conf    2009-07-14 22:38:23 UTC (rev 
8694)
@@ -12,7 +12,7 @@
 #PREFIX = xterm -T transport1 -e
 #PREFIX = xterm -T transport1 -e gdb -x cmd --args
 #PREFIX = xterm -T transport1 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
 
 [arm]
 PORT = 12466
@@ -36,7 +36,7 @@
 #OPTIONS = -l log-core-1
 #PREFIX = xterm -T core1 -e gdb -x cmd --args
 #PREFIX = xterm -T core1 -e 
-#DEBUG = YES
+DEBUG = YES
 
 [testing]
 WEAKRANDOM = YES

Modified: gnunet/src/core/test_core_api_peer2.conf
===================================================================
--- gnunet/src/core/test_core_api_peer2.conf    2009-07-14 22:36:11 UTC (rev 
8693)
+++ gnunet/src/core/test_core_api_peer2.conf    2009-07-14 22:38:23 UTC (rev 
8694)
@@ -11,7 +11,7 @@
 PLUGINS = tcp
 #PREFIX = xterm -T transport2 -e
 #PREFIX = xterm -T transport2 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
 
 [arm]
 PORT = 22466
@@ -33,7 +33,7 @@
 PORT = 22470
 #PREFIX = xterm -T core2 -e
 #PREFIX = xterm -T core2 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
 
 [testing]
 WEAKRANDOM = YES





reply via email to

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