diff options
author | Philipp Tölke <toelke@in.tum.de> | 2011-06-15 07:15:42 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2011-06-15 07:15:42 +0000 |
commit | 9a43c38656071c652b26d089a6c8702eb18c6f15 (patch) | |
tree | 299054e7edf56f6494dddf9b1c277bd91da6458d /src/mesh | |
parent | 70ad34a27e740b4351401f5b4ab4ef5435cca958 (diff) | |
download | gnunet-9a43c38656071c652b26d089a6c8702eb18c6f15.tar.gz gnunet-9a43c38656071c652b26d089a6c8702eb18c6f15.zip |
debug the mock-mesh
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/mesh_api.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 81260c81f..3e480d250 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -177,6 +177,9 @@ static size_t | |||
177 | send_hello_message (void *cls, size_t size, void *buf) | 177 | send_hello_message (void *cls, size_t size, void *buf) |
178 | { | 178 | { |
179 | if (cls == NULL) return 0; | 179 | if (cls == NULL) return 0; |
180 | |||
181 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending hello\n"); | ||
182 | |||
180 | struct GNUNET_MESH_Handle *handle = cls; | 183 | struct GNUNET_MESH_Handle *handle = cls; |
181 | struct GNUNET_MessageHeader *hdr = buf; | 184 | struct GNUNET_MessageHeader *hdr = buf; |
182 | 185 | ||
@@ -203,6 +206,8 @@ core_connect (void *cls, | |||
203 | { | 206 | { |
204 | struct GNUNET_MESH_Handle *handle = cls; | 207 | struct GNUNET_MESH_Handle *handle = cls; |
205 | 208 | ||
209 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Core tells us we are connected to peer %s\n", GNUNET_i2s(peer)); | ||
210 | |||
206 | /* Send a hello to this peer */ | 211 | /* Send a hello to this peer */ |
207 | GNUNET_CORE_notify_transmit_ready(handle->core, | 212 | GNUNET_CORE_notify_transmit_ready(handle->core, |
208 | GNUNET_NO, | 213 | GNUNET_NO, |
@@ -261,6 +266,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
261 | { | 266 | { |
262 | struct GNUNET_MESH_Handle *handle = cls; | 267 | struct GNUNET_MESH_Handle *handle = cls; |
263 | 268 | ||
269 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Core tells us we are no longer connected to peer %s\n", GNUNET_i2s(peer)); | ||
270 | |||
264 | struct peer_list_element *element = handle->connected_peers.head; | 271 | struct peer_list_element *element = handle->connected_peers.head; |
265 | while (element != NULL) | 272 | while (element != NULL) |
266 | { | 273 | { |
@@ -323,6 +330,8 @@ receive_hello (void *cls, | |||
323 | uint16_t *ports = num + 1; | 330 | uint16_t *ports = num + 1; |
324 | unsigned int i; | 331 | unsigned int i; |
325 | 332 | ||
333 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "The peer %s tells us he supports %d application-types.\n", GNUNET_i2s(other), *num); | ||
334 | |||
326 | struct peer_list_element *element = handle->connected_peers.head; | 335 | struct peer_list_element *element = handle->connected_peers.head; |
327 | while (element != NULL) | 336 | while (element != NULL) |
328 | { | 337 | { |
@@ -400,7 +409,11 @@ core_receive (void *cls, | |||
400 | 409 | ||
401 | /* If no handler was found, drop the message but keep the channel open */ | 410 | /* If no handler was found, drop the message but keep the channel open */ |
402 | if (handler->callback == NULL) | 411 | if (handler->callback == NULL) |
403 | return GNUNET_OK; | 412 | { |
413 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received message of type %d from peer %s; dropping it.\n", | ||
414 | ntohs(rmessage->type), GNUNET_i2s(other)); | ||
415 | return GNUNET_OK; | ||
416 | } | ||
404 | 417 | ||
405 | struct tunnel_list_element *tunnel = handle->established_tunnels.head; | 418 | struct tunnel_list_element *tunnel = handle->established_tunnels.head; |
406 | 419 | ||
@@ -420,6 +433,8 @@ core_receive (void *cls, | |||
420 | /* if no tunnel was found: create a new inbound tunnel */ | 433 | /* if no tunnel was found: create a new inbound tunnel */ |
421 | if (tunnel == NULL) | 434 | if (tunnel == NULL) |
422 | { | 435 | { |
436 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "New inbound tunnel from peer %s; first message has type %d.\n", | ||
437 | GNUNET_i2s(other), ntohs(rmessage->type)); | ||
423 | tunnel = GNUNET_malloc (sizeof (struct tunnel_list_element)); | 438 | tunnel = GNUNET_malloc (sizeof (struct tunnel_list_element)); |
424 | tunnel->tunnel.connect_handler = NULL; | 439 | tunnel->tunnel.connect_handler = NULL; |
425 | tunnel->tunnel.disconnect_handler = NULL; | 440 | tunnel->tunnel.disconnect_handler = NULL; |
@@ -435,6 +450,9 @@ core_receive (void *cls, | |||
435 | handle->established_tunnels.tail, | 450 | handle->established_tunnels.tail, |
436 | tunnel); | 451 | tunnel); |
437 | } | 452 | } |
453 | else | ||
454 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Inbound message from peer %s; type %d.\n", | ||
455 | GNUNET_i2s(other), ntohs(rmessage->type)); | ||
438 | 456 | ||
439 | return handler->callback (handle->cls, &tunnel->tunnel, | 457 | return handler->callback (handle->cls, &tunnel->tunnel, |
440 | &tunnel->tunnel.ctx, other, rmessage, atsi); | 458 | &tunnel->tunnel.ctx, other, rmessage, atsi); |
@@ -465,6 +483,8 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *handle, | |||
465 | element = element->next; | 483 | element = element->next; |
466 | } | 484 | } |
467 | 485 | ||
486 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Trying to connect by tupe %d.\n", application_type); | ||
487 | |||
468 | /* Put into pending list */ | 488 | /* Put into pending list */ |
469 | struct tunnel_list_element *tunnel = | 489 | struct tunnel_list_element *tunnel = |
470 | GNUNET_malloc (sizeof (struct tunnel_list_element)); | 490 | GNUNET_malloc (sizeof (struct tunnel_list_element)); |