aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_client.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-11 11:40:21 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-11 11:40:21 +0000
commitd713802b3badf20aa9328207f2a7eb89a859bd83 (patch)
treeb999b9e9c567a40aeb3021dcdf2c598ea88811c1 /src/util/test_client.c
parent274eae7bce4528f38aea2f03a026c95dd6633ef8 (diff)
downloadgnunet-d713802b3badf20aa9328207f2a7eb89a859bd83.tar.gz
gnunet-d713802b3badf20aa9328207f2a7eb89a859bd83.zip
some documentation and bugfix in testcase
Diffstat (limited to 'src/util/test_client.c')
-rw-r--r--src/util/test_client.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/util/test_client.c b/src/util/test_client.c
index 3545b9fa9..a1a268b14 100644
--- a/src/util/test_client.c
+++ b/src/util/test_client.c
@@ -61,6 +61,8 @@ copy_msg (void *cls, size_t size, void *buf)
61 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK); 61 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
62 GNUNET_free (cpy); 62 GNUNET_free (cpy);
63 GNUNET_free (ctx); 63 GNUNET_free (ctx);
64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
65 "Message bounced back to client\n");
64 return sizeof (struct GNUNET_MessageHeader); 66 return sizeof (struct GNUNET_MessageHeader);
65} 67}
66 68
@@ -76,6 +78,8 @@ echo_cb (void *cls,
76 struct CopyContext *cc; 78 struct CopyContext *cc;
77 struct GNUNET_MessageHeader *cpy; 79 struct GNUNET_MessageHeader *cpy;
78 80
81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
82 "Receiving message from client, bouncing back\n");
79 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == 83 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) ==
80 ntohs (message->size)); 84 ntohs (message->size));
81 cc = GNUNET_malloc (sizeof (struct CopyContext)); 85 cc = GNUNET_malloc (sizeof (struct CopyContext));
@@ -104,9 +108,11 @@ recv_bounce (void *cls, const struct GNUNET_MessageHeader *got)
104 struct GNUNET_MessageHeader msg; 108 struct GNUNET_MessageHeader msg;
105 109
106 GNUNET_assert (got != NULL); /* timeout */ 110 GNUNET_assert (got != NULL); /* timeout */
111 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
112 "Receiving bounce, checking content\n");
107 msg.type = htons (MY_TYPE); 113 msg.type = htons (MY_TYPE);
108 msg.size = htons (sizeof (msg)); 114 msg.size = htons (sizeof (struct GNUNET_MessageHeader));
109 GNUNET_assert (0 == memcmp (got, &msg, sizeof (msg))); 115 GNUNET_assert (0 == memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader)));
110 GNUNET_CLIENT_disconnect (client); 116 GNUNET_CLIENT_disconnect (client);
111 client = NULL; 117 client = NULL;
112 GNUNET_SERVER_destroy (server); 118 GNUNET_SERVER_destroy (server);
@@ -121,7 +127,9 @@ make_msg (void *cls, size_t size, void *buf)
121 struct GNUNET_MessageHeader *msg = buf; 127 struct GNUNET_MessageHeader *msg = buf;
122 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); 128 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
123 msg->type = htons (MY_TYPE); 129 msg->type = htons (MY_TYPE);
124 msg->size = htons (sizeof (msg)); 130 msg->size = htons (sizeof (struct GNUNET_MessageHeader));
131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
132 "Creating message for transmission\n");
125 return sizeof (struct GNUNET_MessageHeader); 133 return sizeof (struct GNUNET_MessageHeader);
126} 134}
127 135
@@ -185,7 +193,13 @@ main (int argc, char *argv[])
185{ 193{
186 int ret = 0; 194 int ret = 0;
187 195
188 GNUNET_log_setup ("test_client", "WARNING", NULL); 196 GNUNET_log_setup ("test_client",
197#if VERBOSE
198 "DEBUG",
199#else
200 "WARNING",
201#endif
202 NULL);
189 ret += check (); 203 ret += check ();
190 204
191 return ret; 205 return ret;