summaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_restart_2peers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_transport_api_restart_2peers.c')
-rw-r--r--src/transport/test_transport_api_restart_2peers.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c
index 44a41614f..67cc90f0e 100644
--- a/src/transport/test_transport_api_restart_2peers.c
+++ b/src/transport/test_transport_api_restart_2peers.c
@@ -155,36 +155,36 @@ static void
reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerContext *p = cls;
+
reconnect_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TRANSPORT_try_connect (p1->th, &p2->id);
- reconnect_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
+ reconnect_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
}
static void
restart_cb (struct PeerContext *p, void *cls)
{
static int c;
+
c++;
if (c != 2)
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peer %u (`%4s'), issuing reconnect\n",
- p->no,
+ "Restarted peer %u (`%4s'), issuing reconnect\n", p->no,
GNUNET_i2s (&p->id));
- reconnect_task = GNUNET_SCHEDULER_add_now(&reconnect, p);
+ reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect, p);
}
-static
-void restart (struct PeerContext *p , char * cfg_file)
+static void
+restart (struct PeerContext *p, char *cfg_file)
{
GNUNET_assert (p != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarting peer %u (`%4s')\n",
- p->no,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting peer %u (`%4s')\n", p->no,
GNUNET_i2s (&p->id));
GNUNET_TRANSPORT_TESTING_restart_peer (tth, p, cfg_file, &restart_cb, p);
return;
@@ -205,6 +205,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
GNUNET_assert (t != NULL);
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
@@ -223,8 +224,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peers connected, stopping test...\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Restarted peers connected, stopping test...\n");
ok = 0;
end ();
}
@@ -335,6 +336,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s'): peer (`%s') disconnected from me!\n", p->no, ps,
GNUNET_i2s (peer));
@@ -374,6 +376,7 @@ start_cb (struct PeerContext *p, void *cls)
return;
char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
@@ -457,8 +460,8 @@ main (int argc, char *argv[])
tth = GNUNET_TRANSPORT_TESTING_init ();
- GNUNET_asprintf(&cfg_file_p1,"test_transport_api_tcp_peer1.conf");
- GNUNET_asprintf(&cfg_file_p2,"test_transport_api_tcp_peer2.conf");
+ GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf");
+ GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf");
ret = check ();
@@ -472,4 +475,5 @@ main (int argc, char *argv[])
return ret;
}
+
/* end of test_transport_api_restart_2peers.c */