diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
commit | 652e89b59ed2207c2c12172fdabcd6e659995c81 (patch) | |
tree | f054c819d483c1056e18c1099afd4c7fcd2582a0 /src/util/test_client.c | |
parent | 5e4113e83368849500792e57946c3d8dd9e548d8 (diff) | |
download | gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.tar.gz gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.zip |
fixing bio testcase and a bug in bio.c, also indenting
Diffstat (limited to 'src/util/test_client.c')
-rw-r--r-- | src/util/test_client.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/util/test_client.c b/src/util/test_client.c index 04efd951b..04f002c43 100644 --- a/src/util/test_client.c +++ b/src/util/test_client.c | |||
@@ -61,8 +61,7 @@ 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, | 64 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Message bounced back to client\n"); |
65 | "Message bounced back to client\n"); | ||
66 | return sizeof (struct GNUNET_MessageHeader); | 65 | return sizeof (struct GNUNET_MessageHeader); |
67 | } | 66 | } |
68 | 67 | ||
@@ -79,7 +78,7 @@ echo_cb (void *cls, | |||
79 | struct GNUNET_MessageHeader *cpy; | 78 | struct GNUNET_MessageHeader *cpy; |
80 | 79 | ||
81 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
82 | "Receiving message from client, bouncing back\n"); | 81 | "Receiving message from client, bouncing back\n"); |
83 | GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == | 82 | GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == |
84 | ntohs (message->size)); | 83 | ntohs (message->size)); |
85 | cc = GNUNET_malloc (sizeof (struct CopyContext)); | 84 | cc = GNUNET_malloc (sizeof (struct CopyContext)); |
@@ -109,10 +108,11 @@ recv_bounce (void *cls, const struct GNUNET_MessageHeader *got) | |||
109 | 108 | ||
110 | GNUNET_assert (got != NULL); /* timeout */ | 109 | GNUNET_assert (got != NULL); /* timeout */ |
111 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
112 | "Receiving bounce, checking content\n"); | 111 | "Receiving bounce, checking content\n"); |
113 | msg.type = htons (MY_TYPE); | 112 | msg.type = htons (MY_TYPE); |
114 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 113 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
115 | GNUNET_assert (0 == memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader))); | 114 | GNUNET_assert (0 == |
115 | memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader))); | ||
116 | GNUNET_CLIENT_disconnect (client); | 116 | GNUNET_CLIENT_disconnect (client); |
117 | client = NULL; | 117 | client = NULL; |
118 | GNUNET_SERVER_destroy (server); | 118 | GNUNET_SERVER_destroy (server); |
@@ -128,8 +128,7 @@ make_msg (void *cls, size_t size, void *buf) | |||
128 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); | 128 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
129 | msg->type = htons (MY_TYPE); | 129 | msg->type = htons (MY_TYPE); |
130 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); | 130 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); |
131 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 131 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating message for transmission\n"); |
132 | "Creating message for transmission\n"); | ||
133 | return sizeof (struct GNUNET_MessageHeader); | 132 | return sizeof (struct GNUNET_MessageHeader); |
134 | } | 133 | } |
135 | 134 | ||
@@ -163,9 +162,9 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
163 | GNUNET_assert (NULL != | 162 | GNUNET_assert (NULL != |
164 | GNUNET_CLIENT_notify_transmit_ready (client, | 163 | GNUNET_CLIENT_notify_transmit_ready (client, |
165 | sizeof (struct | 164 | sizeof (struct |
166 | GNUNET_MessageHeader), | 165 | GNUNET_MessageHeader), |
167 | GNUNET_TIME_UNIT_SECONDS, | 166 | GNUNET_TIME_UNIT_SECONDS, |
168 | GNUNET_NO, | 167 | GNUNET_NO, |
169 | &make_msg, NULL)); | 168 | &make_msg, NULL)); |
170 | GNUNET_CLIENT_receive (client, &recv_bounce, cls, | 169 | GNUNET_CLIENT_receive (client, &recv_bounce, cls, |
171 | GNUNET_TIME_relative_multiply | 170 | GNUNET_TIME_relative_multiply |
@@ -199,13 +198,13 @@ main (int argc, char *argv[]) | |||
199 | { | 198 | { |
200 | int ret = 0; | 199 | int ret = 0; |
201 | 200 | ||
202 | GNUNET_log_setup ("test_client", | 201 | GNUNET_log_setup ("test_client", |
203 | #if VERBOSE | 202 | #if VERBOSE |
204 | "DEBUG", | 203 | "DEBUG", |
205 | #else | 204 | #else |
206 | "WARNING", | 205 | "WARNING", |
207 | #endif | 206 | #endif |
208 | NULL); | 207 | NULL); |
209 | ret += check (); | 208 | ret += check (); |
210 | 209 | ||
211 | return ret; | 210 | return ret; |