diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-16 18:43:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-16 18:43:47 +0000 |
commit | b4f6845e9c4b3748c26d9e7bd90bb7f2771e7570 (patch) | |
tree | 6a92af9b681b26f705fa00bd06387cbd14ab2156 /src | |
parent | 6a701a4c1c9309f40eb9b4f4e3c1793fe02bac3e (diff) | |
download | gnunet-b4f6845e9c4b3748c26d9e7bd90bb7f2771e7570.tar.gz gnunet-b4f6845e9c4b3748c26d9e7bd90bb7f2771e7570.zip |
fixes and more debug statements
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core_api.c | 54 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 21 |
2 files changed, 69 insertions, 6 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index c53ecf847..350f3d2b8 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -473,7 +473,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h) | |||
473 | { | 473 | { |
474 | GNUNET_CONTAINER_DLL_remove (h->pending_head, | 474 | GNUNET_CONTAINER_DLL_remove (h->pending_head, |
475 | h->pending_tail, | 475 | h->pending_tail, |
476 | cm); | 476 | cm); |
477 | cm->cont (cm->cont_cls, NULL); | 477 | cm->cont (cm->cont_cls, NULL); |
478 | GNUNET_free (cm); | 478 | GNUNET_free (cm); |
479 | } | 479 | } |
@@ -574,6 +574,11 @@ request_next_transmission (struct PeerRecord *pr) | |||
574 | h->pending_tail, | 574 | h->pending_tail, |
575 | h->pending_tail, | 575 | h->pending_tail, |
576 | cm); | 576 | cm); |
577 | #if DEBUG_CORE | ||
578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
579 | "Adding SEND REQUEST for peer `%s' to message queue\n", | ||
580 | GNUNET_i2s (&pr->peer)); | ||
581 | #endif | ||
577 | trigger_next_request (h, GNUNET_NO); | 582 | trigger_next_request (h, GNUNET_NO); |
578 | } | 583 | } |
579 | 584 | ||
@@ -747,15 +752,33 @@ trigger_next_request (struct GNUNET_CORE_Handle *h, | |||
747 | 752 | ||
748 | if ( (GNUNET_YES == h->currently_down) && | 753 | if ( (GNUNET_YES == h->currently_down) && |
749 | (ignore_currently_down == GNUNET_NO) ) | 754 | (ignore_currently_down == GNUNET_NO) ) |
750 | return; | 755 | { |
756 | #if DEBUG_CORE | ||
757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
758 | "Core connection down, not processing queue\n"); | ||
759 | #endif | ||
760 | return; | ||
761 | } | ||
751 | if (NULL != h->cth) | 762 | if (NULL != h->cth) |
752 | return; | 763 | { |
764 | #if DEBUG_CORE | ||
765 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
766 | "Request pending, not processing queue\n"); | ||
767 | #endif | ||
768 | return; | ||
769 | } | ||
753 | if (h->pending_head != NULL) | 770 | if (h->pending_head != NULL) |
754 | msize = ntohs (((struct GNUNET_MessageHeader*) &h->pending_head[1])->size); | 771 | msize = ntohs (((struct GNUNET_MessageHeader*) &h->pending_head[1])->size); |
755 | else if (h->ready_peer_head != NULL) | 772 | else if (h->ready_peer_head != NULL) |
756 | msize = h->ready_peer_head->pending_head->msize + sizeof (struct SendMessage); | 773 | msize = h->ready_peer_head->pending_head->msize + sizeof (struct SendMessage); |
757 | else | 774 | else |
758 | return; /* no pending message */ | 775 | { |
776 | #if DEBUG_CORE | ||
777 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
778 | "Request queue empty, not processing queue\n"); | ||
779 | #endif | ||
780 | return; /* no pending message */ | ||
781 | } | ||
759 | h->cth = GNUNET_CLIENT_notify_transmit_ready (h->client, | 782 | h->cth = GNUNET_CLIENT_notify_transmit_ready (h->client, |
760 | msize, | 783 | msize, |
761 | GNUNET_TIME_UNIT_FOREVER_REL, | 784 | GNUNET_TIME_UNIT_FOREVER_REL, |
@@ -1466,7 +1489,13 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, | |||
1466 | return NULL; | 1489 | return NULL; |
1467 | } | 1490 | } |
1468 | if (priority <= minp->priority) | 1491 | if (priority <= minp->priority) |
1469 | return NULL; /* priority too low */ | 1492 | { |
1493 | #if DEBUG_CORE | ||
1494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1495 | "Dropping transmission request: priority too low\n"); | ||
1496 | #endif | ||
1497 | return NULL; /* priority too low */ | ||
1498 | } | ||
1470 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, | 1499 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, |
1471 | pr->pending_tail, | 1500 | pr->pending_tail, |
1472 | minp); | 1501 | minp); |
@@ -1502,6 +1531,10 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, | |||
1502 | th); | 1531 | th); |
1503 | pr->queue_size++; | 1532 | pr->queue_size++; |
1504 | /* was the request queue previously empty? */ | 1533 | /* was the request queue previously empty? */ |
1534 | #if DEBUG_CORE | ||
1535 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1536 | "Transmission request added to queue\n"); | ||
1537 | #endif | ||
1505 | if (pr->pending_head == th) | 1538 | if (pr->pending_head == th) |
1506 | request_next_transmission (pr); | 1539 | request_next_transmission (pr); |
1507 | return th; | 1540 | return th; |
@@ -1525,6 +1558,7 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle | |||
1525 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, | 1558 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, |
1526 | pr->pending_tail, | 1559 | pr->pending_tail, |
1527 | th); | 1560 | th); |
1561 | pr->queue_size--; | ||
1528 | if (th->cm != NULL) | 1562 | if (th->cm != NULL) |
1529 | { | 1563 | { |
1530 | /* we're currently in the control queue, remove */ | 1564 | /* we're currently in the control queue, remove */ |
@@ -1658,6 +1692,10 @@ GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h, | |||
1658 | ret->cont_cls = cont_cls; | 1692 | ret->cont_cls = cont_cls; |
1659 | cm->cont = &peer_request_connect_cont; | 1693 | cm->cont = &peer_request_connect_cont; |
1660 | cm->cont_cls = ret; | 1694 | cm->cont_cls = ret; |
1695 | #if DEBUG_CORE | ||
1696 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1697 | "Queueing REQUEST_CONNECT request\n"); | ||
1698 | #endif | ||
1661 | if (h->pending_head == cm) | 1699 | if (h->pending_head == cm) |
1662 | trigger_next_request (h, GNUNET_NO); | 1700 | trigger_next_request (h, GNUNET_NO); |
1663 | return ret; | 1701 | return ret; |
@@ -1804,11 +1842,17 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
1804 | rim->reserve_inbound = htonl (amount); | 1842 | rim->reserve_inbound = htonl (amount); |
1805 | rim->preference_change = GNUNET_htonll(preference); | 1843 | rim->preference_change = GNUNET_htonll(preference); |
1806 | rim->peer = *peer; | 1844 | rim->peer = *peer; |
1845 | #if DEBUG_CORE | ||
1846 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1847 | "Queueing CHANGE PREFERENCE request\n"); | ||
1848 | #endif | ||
1807 | GNUNET_CONTAINER_DLL_insert (h->pending_head, | 1849 | GNUNET_CONTAINER_DLL_insert (h->pending_head, |
1808 | h->pending_tail, | 1850 | h->pending_tail, |
1809 | cm); | 1851 | cm); |
1810 | pr->pcic = info; | 1852 | pr->pcic = info; |
1811 | pr->pcic_cls = info_cls; | 1853 | pr->pcic_cls = info_cls; |
1854 | if (h->pending_head == cm) | ||
1855 | trigger_next_request (h, GNUNET_NO); | ||
1812 | return irc; | 1856 | return irc; |
1813 | } | 1857 | } |
1814 | 1858 | ||
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index bfb17b6c8..e8e12744f 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -1032,7 +1032,13 @@ schedule_peer_messages (struct Neighbour *n) | |||
1032 | mqe = mqe->next; | 1032 | mqe = mqe->next; |
1033 | } | 1033 | } |
1034 | if (queue_size >= MAX_PEER_QUEUE_SIZE) | 1034 | if (queue_size >= MAX_PEER_QUEUE_SIZE) |
1035 | return; /* queue still full */ | 1035 | { |
1036 | #if DEBUG_CORE_CLIENT | ||
1037 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1038 | "Not considering client transmission requests: queue full\n"); | ||
1039 | #endif | ||
1040 | return; /* queue still full */ | ||
1041 | } | ||
1036 | /* find highest priority request */ | 1042 | /* find highest priority request */ |
1037 | pos = n->active_client_request_head; | 1043 | pos = n->active_client_request_head; |
1038 | car = NULL; | 1044 | car = NULL; |
@@ -1045,6 +1051,11 @@ schedule_peer_messages (struct Neighbour *n) | |||
1045 | } | 1051 | } |
1046 | if (car == NULL) | 1052 | if (car == NULL) |
1047 | return; /* no pending requests */ | 1053 | return; /* no pending requests */ |
1054 | #if DEBUG_CORE_CLIENT | ||
1055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1056 | "Permitting client transmission request to `%s'\n", | ||
1057 | GNUNET_i2s (&n->peer)); | ||
1058 | #endif | ||
1048 | c = car->client; | 1059 | c = car->client; |
1049 | GNUNET_CONTAINER_DLL_remove (n->active_client_request_head, | 1060 | GNUNET_CONTAINER_DLL_remove (n->active_client_request_head, |
1050 | n->active_client_request_tail, | 1061 | n->active_client_request_tail, |
@@ -1084,6 +1095,10 @@ handle_client_send_request (void *cls, | |||
1084 | /* neighbour must have disconnected since request was issued, | 1095 | /* neighbour must have disconnected since request was issued, |
1085 | ignore (client will realize it once it processes the | 1096 | ignore (client will realize it once it processes the |
1086 | disconnect notification) */ | 1097 | disconnect notification) */ |
1098 | #if DEBUG_CORE_CLIENT | ||
1099 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1100 | "Dropped client request for transmission (am disconnected)\n"); | ||
1101 | #endif | ||
1087 | GNUNET_STATISTICS_update (stats, | 1102 | GNUNET_STATISTICS_update (stats, |
1088 | gettext_noop ("# send requests dropped (disconnected)"), | 1103 | gettext_noop ("# send requests dropped (disconnected)"), |
1089 | 1, | 1104 | 1, |
@@ -1104,6 +1119,10 @@ handle_client_send_request (void *cls, | |||
1104 | } | 1119 | } |
1105 | if (c->requests == NULL) | 1120 | if (c->requests == NULL) |
1106 | c->requests = GNUNET_CONTAINER_multihashmap_create (16); | 1121 | c->requests = GNUNET_CONTAINER_multihashmap_create (16); |
1122 | #if DEBUG_CORE_CLIENT | ||
1123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1124 | "Received client transmission request. queueing\n"); | ||
1125 | #endif | ||
1107 | car = GNUNET_CONTAINER_multihashmap_get (c->requests, | 1126 | car = GNUNET_CONTAINER_multihashmap_get (c->requests, |
1108 | &req->peer.hashPubKey); | 1127 | &req->peer.hashPubKey); |
1109 | if (car == NULL) | 1128 | if (car == NULL) |