diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-11-07 00:06:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-11-07 00:06:26 +0000 |
commit | 3fd8c038f6b42cd13f20fa82ce2f130d258366c0 (patch) | |
tree | b3e06f7bffac941da29a4f2539e92b764573a7e8 /src/transport/test_transport_api_restart_1peer.c | |
parent | 49f07dd6fa3717c2035f616f973e4b67ac0b4f40 (diff) | |
download | gnunet-3fd8c038f6b42cd13f20fa82ce2f130d258366c0.tar.gz gnunet-3fd8c038f6b42cd13f20fa82ce2f130d258366c0.zip |
-some code cleanup (indentation, redundant branches, etc.)
Diffstat (limited to 'src/transport/test_transport_api_restart_1peer.c')
-rw-r--r-- | src/transport/test_transport_api_restart_1peer.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index 2c4382e9c..86eb299ef 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c | |||
@@ -225,7 +225,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
225 | 225 | ||
226 | th = NULL; | 226 | th = NULL; |
227 | 227 | ||
228 | if (buf == NULL) | 228 | if (NULL == buf) |
229 | { | 229 | { |
230 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 230 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
231 | "Timeout occurred while waiting for transmit_ready\n"); | 231 | "Timeout occurred while waiting for transmit_ready\n"); |
@@ -237,20 +237,23 @@ notify_ready (void *cls, size_t size, void *buf) | |||
237 | } | 237 | } |
238 | 238 | ||
239 | GNUNET_assert (size >= 256); | 239 | GNUNET_assert (size >= 256); |
240 | hdr = buf; | ||
241 | hdr->size = htons (sizeof (struct GNUNET_MessageHeader)); | ||
242 | hdr->type = htons (MTYPE); | ||
240 | 243 | ||
241 | if (buf != NULL) | ||
242 | { | 244 | { |
243 | hdr = buf; | 245 | char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); |
244 | hdr->size = htons (sizeof (struct GNUNET_MessageHeader)); | 246 | |
245 | hdr->type = htons (MTYPE); | 247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
248 | "Peer %u (`%4s') sending message with type %u and size %u bytes to peer %u (`%4s')\n", | ||
249 | p2->no, | ||
250 | ps, | ||
251 | ntohs (hdr->type), | ||
252 | ntohs (hdr->size), | ||
253 | p->no, | ||
254 | GNUNET_i2s (&p->id)); | ||
255 | GNUNET_free (ps); | ||
246 | } | 256 | } |
247 | char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); | ||
248 | |||
249 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
250 | "Peer %u (`%4s') sending message with type %u and size %u bytes to peer %u (`%4s')\n", | ||
251 | p2->no, ps, ntohs (hdr->type), ntohs (hdr->size), p->no, | ||
252 | GNUNET_i2s (&p->id)); | ||
253 | GNUNET_free (ps); | ||
254 | return sizeof (struct GNUNET_MessageHeader); | 257 | return sizeof (struct GNUNET_MessageHeader); |
255 | } | 258 | } |
256 | 259 | ||
@@ -269,14 +272,18 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
269 | p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); | 272 | p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); |
270 | GNUNET_free (receiver_s); | 273 | GNUNET_free (receiver_s); |
271 | 274 | ||
272 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, | 275 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, |
273 | TIMEOUT_TRANSMIT, ¬ify_ready, | 276 | &p1->id, |
277 | 256, | ||
278 | TIMEOUT_TRANSMIT, | ||
279 | ¬ify_ready, | ||
274 | p1); | 280 | p1); |
275 | } | 281 | } |
276 | 282 | ||
277 | 283 | ||
278 | static void | 284 | static void |
279 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | 285 | notify_connect (void *cls, |
286 | const struct GNUNET_PeerIdentity *peer) | ||
280 | { | 287 | { |
281 | static int c; | 288 | static int c; |
282 | 289 | ||