aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_blacklisting.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-11-07 00:06:26 +0000
committerChristian Grothoff <christian@grothoff.org>2015-11-07 00:06:26 +0000
commit3fd8c038f6b42cd13f20fa82ce2f130d258366c0 (patch)
treeb3e06f7bffac941da29a4f2539e92b764573a7e8 /src/transport/test_transport_api_blacklisting.c
parent49f07dd6fa3717c2035f616f973e4b67ac0b4f40 (diff)
downloadgnunet-3fd8c038f6b42cd13f20fa82ce2f130d258366c0.tar.gz
gnunet-3fd8c038f6b42cd13f20fa82ce2f130d258366c0.zip
-some code cleanup (indentation, redundant branches, etc.)
Diffstat (limited to 'src/transport/test_transport_api_blacklisting.c')
-rw-r--r--src/transport/test_transport_api_blacklisting.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c
index 9c3a0c460..f2265028f 100644
--- a/src/transport/test_transport_api_blacklisting.c
+++ b/src/transport/test_transport_api_blacklisting.c
@@ -236,24 +236,28 @@ notify_ready (void *cls, size_t size, void *buf)
236 } 236 }
237 237
238 GNUNET_assert (size >= TEST_MESSAGE_SIZE); 238 GNUNET_assert (size >= TEST_MESSAGE_SIZE);
239 hdr = buf;
240 hdr->size = htons (TEST_MESSAGE_SIZE);
241 hdr->type = htons (TEST_MESSAGE_TYPE);
239 242
240 if (buf != NULL)
241 { 243 {
242 hdr = buf; 244 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id));
243 hdr->size = htons (TEST_MESSAGE_SIZE);
244 hdr->type = htons (TEST_MESSAGE_TYPE);
245 }
246 245
247 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); 246 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
248 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 247 "Peer %u (`%4s') sending message with type %u and size %u bytes to peer %u (`%4s')\n",
249 "Peer %u (`%4s') sending message with type %u and size %u bytes to peer %u (`%4s')\n", 248 p2->no,
250 p2->no, ps, ntohs (hdr->type), ntohs (hdr->size), p->no, 249 ps,
251 GNUNET_i2s (&p->id)); 250 ntohs (hdr->type),
252 GNUNET_free (ps); 251 ntohs (hdr->size),
252 p->no,
253 GNUNET_i2s (&p->id));
254 GNUNET_free (ps);
255 }
253 256
254 return TEST_MESSAGE_SIZE; 257 return TEST_MESSAGE_SIZE;
255} 258}
256 259
260
257static void 261static void
258sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 262sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
259{ 263{
@@ -291,12 +295,17 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
291 t = p2; 295 t = p2;
292 GNUNET_assert (t != NULL); 296 GNUNET_assert (t != NULL);
293 297
294 char *ps = GNUNET_strdup (GNUNET_i2s (&p->id)); 298 {
295 299 char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 300
297 "Peer %u (`%4s'): peer %u (`%s') connected to me!\n", p->no, ps, 301 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
298 t->no, GNUNET_i2s (peer)); 302 "Peer %u (`%4s'): peer %u (`%s') connected to me!\n",
299 GNUNET_free (ps); 303 p->no,
304 ps,
305 t->no,
306 GNUNET_i2s (peer));
307 GNUNET_free (ps);
308 }
300} 309}
301 310
302 311