gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19819 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r19819 - gnunet/src/transport
Date: Thu, 16 Feb 2012 15:28:37 +0100

Author: wachs
Date: 2012-02-16 15:28:37 +0100 (Thu, 16 Feb 2012)
New Revision: 19819

Modified:
   gnunet/src/transport/test_transport_api_restart_1peer.c
Log:
fix test for peer restart


Modified: gnunet/src/transport/test_transport_api_restart_1peer.c
===================================================================
--- gnunet/src/transport/test_transport_api_restart_1peer.c     2012-02-16 
14:21:22 UTC (rev 19818)
+++ gnunet/src/transport/test_transport_api_restart_1peer.c     2012-02-16 
14:28:37 UTC (rev 19819)
@@ -65,8 +65,12 @@
 
 struct PeerContext *p1;
 
+int p1_connected;
+
 struct PeerContext *p2;
 
+int p2_connected;
+
 static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
 
 struct GNUNET_TRANSPORT_TransmitHandle *th;
@@ -217,8 +221,8 @@
     }
     else
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Restarted peers connected, stopping test...\n");
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Restarted peers connected and message was sent, stopping 
test...\n");
       ok = 0;
       end ();
     }
@@ -303,9 +307,15 @@
   struct PeerContext *t = NULL;
 
   if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity)))
+  {
+    p1_connected = GNUNET_YES;
     t = p1;
+  }
   if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity)))
+  {
+    p2_connected = GNUNET_YES;
     t = p2;
+  }
   GNUNET_assert (t != NULL);
 
   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
@@ -315,8 +325,9 @@
               t->no, GNUNET_i2s (peer));
   GNUNET_free (ps);
 
-  if ((restarted == GNUNET_YES) && (c == 4))
+  if ((restarted == GNUNET_YES) && ((p1_connected == GNUNET_YES) && 
(p2_connected == GNUNET_YES)))
   {
+    /* Peer was restarted and we received 3 connect messages (2 from first 
connect, 1 from reconnect) */
     send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL);
   }
 }
@@ -327,7 +338,16 @@
 {
   struct PeerContext *p = cls;
 
+  if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity)))
+  {
+    p1_connected = GNUNET_NO;
+  }
+  if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity)))
+  {
+    p2_connected = GNUNET_NO;
+  }
 
+
   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -385,7 +405,8 @@
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
-
+  p1_connected = GNUNET_NO;
+  p2_connected = GNUNET_NO;
   p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p1, 1,
                                             &notify_receive, &notify_connect,
                                             &notify_disconnect, &start_cb,




reply via email to

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