summaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-27 10:54:36 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-27 10:54:36 +0000
commitdc3ae8f36ec69ca2a96a93feda501682ff168320 (patch)
treea7b1af54f1bdd34ce59d442f87c91f7979b6e547 /src/transport/test_transport_api.c
parentf632382b95605adb705bc7df830e016ed1f7735a (diff)
adding error messages
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r--src/transport/test_transport_api.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index 7596c30b1..021dec87a 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -64,6 +64,10 @@ static char *test_name;
static int ok;
+static int s_started;
+static int s_connected;
+static int s_sending;
+
static GNUNET_SCHEDULER_TaskIdentifier die_task;
static GNUNET_SCHEDULER_TaskIdentifier send_task;
@@ -127,12 +131,34 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (th != NULL)
GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not ready to send data\n"));
+
+ if (s_started == GNUNET_NO)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peers were not started n"));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peers were started n"));
+
+ if (s_connected == GNUNET_NO)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not connected\n"));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were connected\n"));
+
+ if (s_sending == GNUNET_NO)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not ready to send data\n"));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were ready to send data\n"));
+
th = NULL;
if (p1 != NULL)
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer 1 was not started\n"));
if (p2 != NULL)
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer 2 was not started\n"));
ok = GNUNET_SYSERR;
}
@@ -227,7 +253,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
"Sending message from peer %u (`%4s') -> peer %u (`%s') !\n",
p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s);
GNUNET_free (receiver_s);
-
+ s_sending = GNUNET_YES;
th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE, 0,
TIMEOUT_TRANSMIT, &notify_ready,
p1);
@@ -286,6 +312,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id));
GNUNET_free (p1_c);
+ s_connected = GNUNET_YES;
send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL);
}
@@ -303,7 +330,8 @@ start_cb (struct PeerContext *p, void *cls)
if (started != 2)
return;
-
+ else
+ s_started = GNUNET_YES;
char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -322,6 +350,10 @@ run (void *cls, char *const *args, const char *cfgfile,
{
die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
+ s_started = GNUNET_NO;
+ s_connected = GNUNET_NO;
+ s_sending = GNUNET_NO;
+
p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p1, 1,
&notify_receive, &notify_connect,
&notify_disconnect, &start_cb,