diff options
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/mesh_api.c | 65 | ||||
-rw-r--r-- | src/mesh/mesh_api_new.c | 82 |
2 files changed, 72 insertions, 75 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 9c2af545b..871318755 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <gnunet_container_lib.h> | 32 | #include <gnunet_container_lib.h> |
33 | #include <gnunet_applications.h> | 33 | #include <gnunet_applications.h> |
34 | 34 | ||
35 | #define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__) | ||
36 | |||
35 | struct tunnel_id | 37 | struct tunnel_id |
36 | { | 38 | { |
37 | uint32_t id GNUNET_PACKED; | 39 | uint32_t id GNUNET_PACKED; |
@@ -196,7 +198,7 @@ send_hello_message (void *cls, size_t size, void *buf) | |||
196 | if (cls == NULL) | 198 | if (cls == NULL) |
197 | return 0; | 199 | return 0; |
198 | 200 | ||
199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending hello\n"); | 201 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending hello\n"); |
200 | 202 | ||
201 | struct peer_list_element *element = cls; | 203 | struct peer_list_element *element = cls; |
202 | struct GNUNET_MESH_Handle *handle = element->handle; | 204 | struct GNUNET_MESH_Handle *handle = element->handle; |
@@ -256,8 +258,8 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
256 | { | 258 | { |
257 | struct GNUNET_MESH_Handle *handle = cls; | 259 | struct GNUNET_MESH_Handle *handle = cls; |
258 | 260 | ||
259 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 261 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Core tells us we are connected to peer %s\n", |
260 | "Core tells us we are connected to peer %s\n", GNUNET_i2s (peer)); | 262 | GNUNET_i2s (peer)); |
261 | 263 | ||
262 | /* put the new peer into the list of connected peers */ | 264 | /* put the new peer into the list of connected peers */ |
263 | struct peer_list_element *element = | 265 | struct peer_list_element *element = |
@@ -312,9 +314,9 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
312 | { | 314 | { |
313 | struct GNUNET_MESH_Handle *handle = cls; | 315 | struct GNUNET_MESH_Handle *handle = cls; |
314 | 316 | ||
315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 317 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
316 | "Core tells us we are no longer connected to peer %s\n", | 318 | "Core tells us we are no longer connected to peer %s\n", |
317 | GNUNET_i2s (peer)); | 319 | GNUNET_i2s (peer)); |
318 | 320 | ||
319 | struct peer_list_element *element = handle->connected_peers.head; | 321 | struct peer_list_element *element = handle->connected_peers.head; |
320 | 322 | ||
@@ -389,9 +391,9 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, | |||
389 | (GNUNET_MESH_ApplicationType *) (num + 1); | 391 | (GNUNET_MESH_ApplicationType *) (num + 1); |
390 | unsigned int i; | 392 | unsigned int i; |
391 | 393 | ||
392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 394 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "The peer %s tells us he supports %d application-types.\n", | 395 | "The peer %s tells us he supports %d application-types.\n", |
394 | GNUNET_i2s (other), ntohs (*num)); | 396 | GNUNET_i2s (other), ntohs (*num)); |
395 | 397 | ||
396 | struct peer_list_element *element = handle->connected_peers.head; | 398 | struct peer_list_element *element = handle->connected_peers.head; |
397 | 399 | ||
@@ -407,9 +409,9 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, | |||
407 | 409 | ||
408 | for (i = 0; i < ntohs (*num); i++) | 410 | for (i = 0; i < ntohs (*num); i++) |
409 | { | 411 | { |
410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 412 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
411 | "The peer %s newly supports the application-type %d\n", | 413 | "The peer %s newly supports the application-type %d\n", |
412 | GNUNET_i2s (other), ntohs (ports[i])); | 414 | GNUNET_i2s (other), ntohs (ports[i])); |
413 | if (GNUNET_APPLICATION_TYPE_END == ntohs (ports[i])) | 415 | if (GNUNET_APPLICATION_TYPE_END == ntohs (ports[i])) |
414 | continue; | 416 | continue; |
415 | struct type_list_element *new_type = GNUNET_malloc (sizeof *new_type); | 417 | struct type_list_element *new_type = GNUNET_malloc (sizeof *new_type); |
@@ -423,9 +425,9 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, | |||
423 | 425 | ||
424 | for (type = element->type_head; type != NULL; type = type->next) | 426 | for (type = element->type_head; type != NULL; type = type->next) |
425 | { | 427 | { |
426 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 428 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
427 | "The peer %s supports the application-type %d\n", | 429 | "The peer %s supports the application-type %d\n", GNUNET_i2s (other), |
428 | GNUNET_i2s (other), type->type); | 430 | type->type); |
429 | } | 431 | } |
430 | 432 | ||
431 | struct tunnel_list_element *tunnel = handle->pending_by_type_tunnels.head; | 433 | struct tunnel_list_element *tunnel = handle->pending_by_type_tunnels.head; |
@@ -491,9 +493,9 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other, | |||
491 | /* If no handler was found, drop the message but keep the channel open */ | 493 | /* If no handler was found, drop the message but keep the channel open */ |
492 | if (handler->callback == NULL) | 494 | if (handler->callback == NULL) |
493 | { | 495 | { |
494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 496 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
495 | "Received message of type %d from peer %s; dropping it.\n", | 497 | "Received message of type %d from peer %s; dropping it.\n", |
496 | ntohs (rmessage->type), GNUNET_i2s (other)); | 498 | ntohs (rmessage->type), GNUNET_i2s (other)); |
497 | return GNUNET_OK; | 499 | return GNUNET_OK; |
498 | } | 500 | } |
499 | 501 | ||
@@ -515,9 +517,9 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other, | |||
515 | /* if no tunnel was found: create a new inbound tunnel */ | 517 | /* if no tunnel was found: create a new inbound tunnel */ |
516 | if (tunnel == NULL) | 518 | if (tunnel == NULL) |
517 | { | 519 | { |
518 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 520 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
519 | "New inbound tunnel from peer %s; first message has type %d.\n", | 521 | "New inbound tunnel from peer %s; first message has type %d.\n", |
520 | GNUNET_i2s (other), ntohs (rmessage->type)); | 522 | GNUNET_i2s (other), ntohs (rmessage->type)); |
521 | tunnel = GNUNET_malloc (sizeof (struct tunnel_list_element)); | 523 | tunnel = GNUNET_malloc (sizeof (struct tunnel_list_element)); |
522 | tunnel->tunnel.connect_handler = NULL; | 524 | tunnel->tunnel.connect_handler = NULL; |
523 | tunnel->tunnel.disconnect_handler = NULL; | 525 | tunnel->tunnel.disconnect_handler = NULL; |
@@ -533,9 +535,8 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other, | |||
533 | tunnel); | 535 | tunnel); |
534 | } | 536 | } |
535 | else | 537 | else |
536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 538 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Inbound message from peer %s; type %d.\n", |
537 | "Inbound message from peer %s; type %d.\n", GNUNET_i2s (other), | 539 | GNUNET_i2s (other), ntohs (rmessage->type)); |
538 | ntohs (rmessage->type)); | ||
539 | 540 | ||
540 | return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx, | 541 | return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx, |
541 | other, rmessage, atsi); | 542 | other, rmessage, atsi); |
@@ -568,8 +569,8 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *handle, | |||
568 | element = element->next; | 569 | element = element->next; |
569 | } | 570 | } |
570 | 571 | ||
571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect by tupe %d.\n", | 572 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect by tupe %d.\n", |
572 | application_type); | 573 | application_type); |
573 | 574 | ||
574 | /* Put into pending list */ | 575 | /* Put into pending list */ |
575 | struct tunnel_list_element *tunnel = | 576 | struct tunnel_list_element *tunnel = |
@@ -809,7 +810,7 @@ build_hello_message (struct GNUNET_MESH_Handle *handle, | |||
809 | 810 | ||
810 | for (t = stypes; *t != GNUNET_APPLICATION_TYPE_END; t++, num++) ; | 811 | for (t = stypes; *t != GNUNET_APPLICATION_TYPE_END; t++, num++) ; |
811 | 812 | ||
812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I can handle %d app-types.\n", num); | 813 | LOG (GNUNET_ERROR_TYPE_DEBUG, "I can handle %d app-types.\n", num); |
813 | 814 | ||
814 | handle->hello_message_size = sizeof (uint16_t) + /* For the number of types */ | 815 | handle->hello_message_size = sizeof (uint16_t) + /* For the number of types */ |
815 | num * sizeof (GNUNET_MESH_ApplicationType); /* For the types */ | 816 | num * sizeof (GNUNET_MESH_ApplicationType); /* For the types */ |
@@ -824,8 +825,7 @@ build_hello_message (struct GNUNET_MESH_Handle *handle, | |||
824 | 825 | ||
825 | for (i = 0; i < num; i++) | 826 | for (i = 0; i < num; i++) |
826 | { | 827 | { |
827 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I can handle the app-type %d\n", | 828 | LOG (GNUNET_ERROR_TYPE_DEBUG, "I can handle the app-type %d\n", stypes[i]); |
828 | stypes[i]); | ||
829 | types[i] = htons (stypes[i]); | 829 | types[i] = htons (stypes[i]); |
830 | } | 830 | } |
831 | 831 | ||
@@ -872,10 +872,9 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | |||
872 | 872 | ||
873 | ret->core = | 873 | ret->core = |
874 | GNUNET_CORE_connect (cfg, 42, ret, &core_startup, &core_connect, | 874 | GNUNET_CORE_connect (cfg, 42, ret, &core_startup, &core_connect, |
875 | &core_disconnect, NULL, GNUNET_NO, NULL, | 875 | &core_disconnect, NULL, GNUNET_NO, NULL, GNUNET_NO, |
876 | GNUNET_NO, core_handlers); | 876 | core_handlers); |
877 | ret->transport = | 877 | ret->transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); |
878 | GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); | ||
879 | return ret; | 878 | return ret; |
880 | } | 879 | } |
881 | 880 | ||
diff --git a/src/mesh/mesh_api_new.c b/src/mesh/mesh_api_new.c index 142427c97..d3ce0b2ae 100644 --- a/src/mesh/mesh_api_new.c +++ b/src/mesh/mesh_api_new.c | |||
@@ -47,6 +47,8 @@ extern "C" | |||
47 | 47 | ||
48 | #define DEBUG GNUNET_YES | 48 | #define DEBUG GNUNET_YES |
49 | 49 | ||
50 | #define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__) | ||
51 | |||
50 | /******************************************************************************/ | 52 | /******************************************************************************/ |
51 | /************************ DATA STRUCTURES ****************************/ | 53 | /************************ DATA STRUCTURES ****************************/ |
52 | /******************************************************************************/ | 54 | /******************************************************************************/ |
@@ -581,9 +583,9 @@ reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
581 | /** | 583 | /** |
582 | * Send a connect packet to the service with the applications and types | 584 | * Send a connect packet to the service with the applications and types |
583 | * requested by the user. | 585 | * requested by the user. |
584 | * | 586 | * |
585 | * @param h The mesh handle. | 587 | * @param h The mesh handle. |
586 | * | 588 | * |
587 | */ | 589 | */ |
588 | static void | 590 | static void |
589 | send_connect (struct GNUNET_MESH_Handle *h) | 591 | send_connect (struct GNUNET_MESH_Handle *h) |
@@ -609,8 +611,7 @@ send_connect (struct GNUNET_MESH_Handle *h) | |||
609 | for (napps = 0; napps < h->n_applications; napps++) | 611 | for (napps = 0; napps < h->n_applications; napps++) |
610 | { | 612 | { |
611 | apps[napps] = htonl (h->applications[napps]); | 613 | apps[napps] = htonl (h->applications[napps]); |
612 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: app %u\n", | 614 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: app %u\n", h->applications[napps]); |
613 | h->applications[napps]); | ||
614 | } | 615 | } |
615 | types = (uint16_t *) & apps[napps]; | 616 | types = (uint16_t *) & apps[napps]; |
616 | for (ntypes = 0; ntypes < h->n_handlers; ntypes++) | 617 | for (ntypes = 0; ntypes < h->n_handlers; ntypes++) |
@@ -618,9 +619,9 @@ send_connect (struct GNUNET_MESH_Handle *h) | |||
618 | msg->applications = htons (napps); | 619 | msg->applications = htons (napps); |
619 | msg->types = htons (ntypes); | 620 | msg->types = htons (ntypes); |
620 | #if DEBUG | 621 | #if DEBUG |
621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 622 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
622 | "mesh: Sending %lu bytes long message %d types and %d apps\n", | 623 | "mesh: Sending %lu bytes long message %d types and %d apps\n", |
623 | ntohs (msg->header.size), ntypes, napps); | 624 | ntohs (msg->header.size), ntypes, napps); |
624 | #endif | 625 | #endif |
625 | send_packet (h, &msg->header); | 626 | send_packet (h, &msg->header); |
626 | } | 627 | } |
@@ -642,9 +643,9 @@ reconnect (struct GNUNET_MESH_Handle *h) | |||
642 | unsigned int i; | 643 | unsigned int i; |
643 | 644 | ||
644 | #if DEBUG | 645 | #if DEBUG |
645 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: *****************************\n"); | 646 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: *****************************\n"); |
646 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: ******* RECONNECT *******\n"); | 647 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: ******* RECONNECT *******\n"); |
647 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: *****************************\n"); | 648 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: *****************************\n"); |
648 | #endif | 649 | #endif |
649 | h->in_receive = GNUNET_NO; | 650 | h->in_receive = GNUNET_NO; |
650 | /* disconnect */ | 651 | /* disconnect */ |
@@ -666,9 +667,8 @@ reconnect (struct GNUNET_MESH_Handle *h) | |||
666 | GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS, | 667 | GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS, |
667 | GNUNET_TIME_relative_multiply | 668 | GNUNET_TIME_relative_multiply |
668 | (h->reconnect_time, 2)); | 669 | (h->reconnect_time, 2)); |
669 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 670 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Next retry in %sms\n", |
670 | "mesh: Next retry in %sms\n", | 671 | GNUNET_TIME_relative_to_string (h->reconnect_time)); |
671 | GNUNET_TIME_relative_to_string(h->reconnect_time)); | ||
672 | GNUNET_break (0); | 672 | GNUNET_break (0); |
673 | return GNUNET_NO; | 673 | return GNUNET_NO; |
674 | } | 674 | } |
@@ -676,7 +676,7 @@ reconnect (struct GNUNET_MESH_Handle *h) | |||
676 | { | 676 | { |
677 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; | 677 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; |
678 | } | 678 | } |
679 | send_connect(h); | 679 | send_connect (h); |
680 | /* Rebuild all tunnels */ | 680 | /* Rebuild all tunnels */ |
681 | for (t = h->tunnels_head; NULL != t; t = t->next) | 681 | for (t = h->tunnels_head; NULL != t; t = t->next) |
682 | { | 682 | { |
@@ -825,7 +825,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h, | |||
825 | GNUNET_PEER_Id id; | 825 | GNUNET_PEER_Id id; |
826 | uint16_t size; | 826 | uint16_t size; |
827 | 827 | ||
828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: processig peer event\n"); | 828 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: processig peer event\n"); |
829 | size = ntohs (msg->header.size); | 829 | size = ntohs (msg->header.size); |
830 | if (size != sizeof (struct GNUNET_MESH_PeerControl)) | 830 | if (size != sizeof (struct GNUNET_MESH_PeerControl)) |
831 | { | 831 | { |
@@ -843,7 +843,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h, | |||
843 | p = add_peer_to_tunnel (t, &msg->peer); | 843 | p = add_peer_to_tunnel (t, &msg->peer); |
844 | if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD == ntohs (msg->header.type)) | 844 | if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD == ntohs (msg->header.type)) |
845 | { | 845 | { |
846 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: adding peer\n"); | 846 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: adding peer\n"); |
847 | if (NULL != t->connect_handler) | 847 | if (NULL != t->connect_handler) |
848 | { | 848 | { |
849 | atsi.type = 0; | 849 | atsi.type = 0; |
@@ -854,7 +854,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h, | |||
854 | } | 854 | } |
855 | else | 855 | else |
856 | { | 856 | { |
857 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: removing peer\n"); | 857 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: removing peer\n"); |
858 | if (NULL != t->disconnect_handler && p->connected) | 858 | if (NULL != t->disconnect_handler && p->connected) |
859 | { | 859 | { |
860 | t->disconnect_handler (t->cls, &msg->peer); | 860 | t->disconnect_handler (t->cls, &msg->peer); |
@@ -862,7 +862,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h, | |||
862 | remove_peer_from_tunnel (p); | 862 | remove_peer_from_tunnel (p); |
863 | GNUNET_free (p); | 863 | GNUNET_free (p); |
864 | } | 864 | } |
865 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: processing peer event END\n"); | 865 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: processing peer event END\n"); |
866 | } | 866 | } |
867 | 867 | ||
868 | 868 | ||
@@ -930,16 +930,15 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, | |||
930 | if (GNUNET_OK != | 930 | if (GNUNET_OK != |
931 | handler->callback (h->cls, t, &t->ctx, peer, payload, &atsi)) | 931 | handler->callback (h->cls, t, &t->ctx, peer, payload, &atsi)) |
932 | { | 932 | { |
933 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 933 | LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH: callback caused disconnection\n"); |
934 | "MESH: callback caused disconnection\n"); | ||
935 | GNUNET_MESH_disconnect (h); | 934 | GNUNET_MESH_disconnect (h); |
936 | return; | 935 | return; |
937 | } | 936 | } |
938 | #if DEBUG | 937 | #if DEBUG |
939 | else | 938 | else |
940 | { | 939 | { |
941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 940 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
942 | "MESH: callback completed successfully\n"); | 941 | "MESH: callback completed successfully\n"); |
943 | 942 | ||
944 | } | 943 | } |
945 | #endif | 944 | #endif |
@@ -964,9 +963,8 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
964 | reconnect (h); | 963 | reconnect (h); |
965 | return; | 964 | return; |
966 | } | 965 | } |
967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 966 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: received a message type %hu from MESH\n", |
968 | "mesh: received a message type %hu from MESH\n", | 967 | ntohs (msg->type)); |
969 | ntohs (msg->type)); | ||
970 | switch (ntohs (msg->type)) | 968 | switch (ntohs (msg->type)) |
971 | { | 969 | { |
972 | /* Notify of a new incoming tunnel */ | 970 | /* Notify of a new incoming tunnel */ |
@@ -990,11 +988,11 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
990 | break; | 988 | break; |
991 | /* We shouldn't get any other packages, log and ignore */ | 989 | /* We shouldn't get any other packages, log and ignore */ |
992 | default: | 990 | default: |
993 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 991 | LOG (GNUNET_ERROR_TYPE_WARNING, |
994 | "MESH: unsolicited message form service (type %d)\n", | 992 | "MESH: unsolicited message form service (type %d)\n", |
995 | ntohs (msg->type)); | 993 | ntohs (msg->type)); |
996 | } | 994 | } |
997 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: message processed\n"); | 995 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: message processed\n"); |
998 | GNUNET_CLIENT_receive (h->client, &msg_received, h, | 996 | GNUNET_CLIENT_receive (h->client, &msg_received, h, |
999 | GNUNET_TIME_UNIT_FOREVER_REL); | 997 | GNUNET_TIME_UNIT_FOREVER_REL); |
1000 | } | 998 | } |
@@ -1023,7 +1021,7 @@ send_callback (void *cls, size_t size, void *buf) | |||
1023 | size_t tsize; | 1021 | size_t tsize; |
1024 | size_t psize; | 1022 | size_t psize; |
1025 | 1023 | ||
1026 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send packet() Buffer %u\n", size); | 1024 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send packet() Buffer %u\n", size); |
1027 | h->th = NULL; | 1025 | h->th = NULL; |
1028 | if ((0 == size) || (NULL == buf)) | 1026 | if ((0 == size) || (NULL == buf)) |
1029 | { | 1027 | { |
@@ -1034,10 +1032,10 @@ send_callback (void *cls, size_t size, void *buf) | |||
1034 | while ((NULL != (th = h->th_head)) && (size >= th->size)) | 1032 | while ((NULL != (th = h->th_head)) && (size >= th->size)) |
1035 | { | 1033 | { |
1036 | #if DEBUG | 1034 | #if DEBUG |
1037 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: type: %u\n", | 1035 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: type: %u\n", |
1038 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->type)); | 1036 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->type)); |
1039 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: size: %u\n", | 1037 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: size: %u\n", |
1040 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->size)); | 1038 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->size)); |
1041 | #endif | 1039 | #endif |
1042 | if (NULL != th->notify) | 1040 | if (NULL != th->notify) |
1043 | { | 1041 | { |
@@ -1092,16 +1090,16 @@ send_callback (void *cls, size_t size, void *buf) | |||
1092 | size -= psize; | 1090 | size -= psize; |
1093 | tsize += psize; | 1091 | tsize += psize; |
1094 | } | 1092 | } |
1095 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: total size: %u\n", tsize); | 1093 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: total size: %u\n", tsize); |
1096 | if (NULL != (th = h->th_head)) | 1094 | if (NULL != (th = h->th_head)) |
1097 | { | 1095 | { |
1098 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: next size: %u\n", th->size); | 1096 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: next size: %u\n", th->size); |
1099 | h->th = | 1097 | h->th = |
1100 | GNUNET_CLIENT_notify_transmit_ready (h->client, th->size, | 1098 | GNUNET_CLIENT_notify_transmit_ready (h->client, th->size, |
1101 | GNUNET_TIME_UNIT_FOREVER_REL, | 1099 | GNUNET_TIME_UNIT_FOREVER_REL, |
1102 | GNUNET_YES, &send_callback, h); | 1100 | GNUNET_YES, &send_callback, h); |
1103 | } | 1101 | } |
1104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send packet() END\n"); | 1102 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send packet() END\n"); |
1105 | if (GNUNET_NO == h->in_receive) | 1103 | if (GNUNET_NO == h->in_receive) |
1106 | { | 1104 | { |
1107 | h->in_receive = GNUNET_YES; | 1105 | h->in_receive = GNUNET_YES; |
@@ -1175,7 +1173,7 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1175 | { | 1173 | { |
1176 | struct GNUNET_MESH_Handle *h; | 1174 | struct GNUNET_MESH_Handle *h; |
1177 | 1175 | ||
1178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: GNUNET_MESH_connect()\n"); | 1176 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: GNUNET_MESH_connect()\n"); |
1179 | h = GNUNET_malloc (sizeof (struct GNUNET_MESH_Handle)); | 1177 | h = GNUNET_malloc (sizeof (struct GNUNET_MESH_Handle)); |
1180 | h->cfg = cfg; | 1178 | h->cfg = cfg; |
1181 | h->max_queue_size = queue_size; | 1179 | h->max_queue_size = queue_size; |
@@ -1198,8 +1196,8 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1198 | /* count handlers and apps, calculate size */ | 1196 | /* count handlers and apps, calculate size */ |
1199 | for (h->n_applications = 0; stypes[h->n_applications]; h->n_applications++) ; | 1197 | for (h->n_applications = 0; stypes[h->n_applications]; h->n_applications++) ; |
1200 | for (h->n_handlers = 0; handlers[h->n_handlers].type; h->n_handlers++) ; | 1198 | for (h->n_handlers = 0; handlers[h->n_handlers].type; h->n_handlers++) ; |
1201 | send_connect(h); | 1199 | send_connect (h); |
1202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: GNUNET_MESH_connect() END\n"); | 1200 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: GNUNET_MESH_connect() END\n"); |
1203 | return h; | 1201 | return h; |
1204 | } | 1202 | } |
1205 | 1203 | ||
@@ -1253,7 +1251,7 @@ GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx, | |||
1253 | struct GNUNET_MESH_Tunnel *t; | 1251 | struct GNUNET_MESH_Tunnel *t; |
1254 | struct GNUNET_MESH_TunnelMessage msg; | 1252 | struct GNUNET_MESH_TunnelMessage msg; |
1255 | 1253 | ||
1256 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Creating new tunnel\n"); | 1254 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Creating new tunnel\n"); |
1257 | t = create_tunnel (h, 0); | 1255 | t = create_tunnel (h, 0); |
1258 | t->connect_handler = connect_handler; | 1256 | t->connect_handler = connect_handler; |
1259 | t->disconnect_handler = disconnect_handler; | 1257 | t->disconnect_handler = disconnect_handler; |
@@ -1278,7 +1276,7 @@ GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel) | |||
1278 | struct GNUNET_MESH_Handle *h; | 1276 | struct GNUNET_MESH_Handle *h; |
1279 | struct GNUNET_MESH_TunnelMessage msg; | 1277 | struct GNUNET_MESH_TunnelMessage msg; |
1280 | 1278 | ||
1281 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n"); | 1279 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n"); |
1282 | h = tunnel->mesh; | 1280 | h = tunnel->mesh; |
1283 | 1281 | ||
1284 | if (0 != tunnel->owner) | 1282 | if (0 != tunnel->owner) |