diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-10 17:23:13 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-10 17:23:13 +0000 |
commit | 0866f018ec9465d261664c013e714d0e8a1a0092 (patch) | |
tree | c6962f64406ae2ba8fb70b9628c44599ade6587a /src/mesh | |
parent | 5d7d01298cfcde6516cecac01f6bfff31bc20461 (diff) | |
download | gnunet-0866f018ec9465d261664c013e714d0e8a1a0092.tar.gz gnunet-0866f018ec9465d261664c013e714d0e8a1a0092.zip |
- move connection message accounting
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 57 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 85 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.h | 6 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 1 |
4 files changed, 68 insertions, 81 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 2feeab7cd..63e4b8bd0 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -353,20 +353,25 @@ connection_change_state (struct MeshConnection* c, | |||
353 | * | 353 | * |
354 | * @param cls Closure. | 354 | * @param cls Closure. |
355 | * @param c Connection this message was on. | 355 | * @param c Connection this message was on. |
356 | * @param type Type of message sent. | ||
357 | * @param fwd Was this a FWD going message? | ||
358 | * @param size Size of the message. | ||
356 | * @param wait Time spent waiting for core (only the time for THIS message) | 359 | * @param wait Time spent waiting for core (only the time for THIS message) |
357 | */ | 360 | */ |
358 | static void | 361 | static void |
359 | message_sent (void *cls, | 362 | message_sent (void *cls, |
360 | struct MeshConnection *c, | 363 | struct MeshConnection *c, uint16_t type, |
364 | int fwd, size_t size, | ||
361 | struct GNUNET_TIME_Relative wait) | 365 | struct GNUNET_TIME_Relative wait) |
362 | { | 366 | { |
363 | struct MeshConnectionPerformance *p; | 367 | struct MeshConnectionPerformance *p; |
364 | size_t size = (size_t) cls; | 368 | struct MeshFlowControl *fc; |
365 | double usecsperbyte; | 369 | double usecsperbyte; |
366 | 370 | ||
367 | if (NULL == c->perf) | 371 | if (NULL == c->perf) |
368 | return; /* Only endpoints are interested in this. */ | 372 | return; /* Only endpoints are interested in this. */ |
369 | 373 | ||
374 | LOG (GNUNET_ERROR_TYPE_DEBUG, "! message sent!\n"); | ||
370 | p = c->perf; | 375 | p = c->perf; |
371 | usecsperbyte = ((double) wait.rel_value_us) / size; | 376 | usecsperbyte = ((double) wait.rel_value_us) / size; |
372 | if (p->size == AVG_MSGS) | 377 | if (p->size == AVG_MSGS) |
@@ -386,6 +391,16 @@ message_sent (void *cls, | |||
386 | p->avg /= p->size; | 391 | p->avg /= p->size; |
387 | } | 392 | } |
388 | p->idx = (p->idx + 1) % AVG_MSGS; | 393 | p->idx = (p->idx + 1) % AVG_MSGS; |
394 | |||
395 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
396 | LOG (GNUNET_ERROR_TYPE_DEBUG, "! Q_N- %p %u\n", fc, fc->queue_n); | ||
397 | fc->queue_n--; | ||
398 | c->pending_messages--; | ||
399 | if (GNUNET_YES == c->destroy && 0 == c->pending_messages) | ||
400 | { | ||
401 | LOG (GNUNET_ERROR_TYPE_DEBUG, "! destroying connection!\n"); | ||
402 | GMC_destroy (c); | ||
403 | } | ||
389 | } | 404 | } |
390 | 405 | ||
391 | 406 | ||
@@ -528,8 +543,7 @@ send_connection_ack (struct MeshConnection *connection, int fwd) | |||
528 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, | 543 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, |
529 | sizeof (struct GNUNET_MESH_ConnectionACK), | 544 | sizeof (struct GNUNET_MESH_ConnectionACK), |
530 | connection, NULL, fwd, | 545 | connection, NULL, fwd, |
531 | &message_sent, | 546 | &message_sent, NULL); |
532 | (void *) sizeof (struct GNUNET_MESH_ConnectionACK)); | ||
533 | if (MESH_TUNNEL3_NEW == GMT_get_state (t)) | 547 | if (MESH_TUNNEL3_NEW == GMT_get_state (t)) |
534 | GMT_change_state (t, MESH_TUNNEL3_WAITING); | 548 | GMT_change_state (t, MESH_TUNNEL3_WAITING); |
535 | if (MESH_CONNECTION_READY != connection->state) | 549 | if (MESH_CONNECTION_READY != connection->state) |
@@ -1933,9 +1947,11 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1933 | struct MeshChannel *ch, | 1947 | struct MeshChannel *ch, |
1934 | int fwd) | 1948 | int fwd) |
1935 | { | 1949 | { |
1950 | struct MeshFlowControl *fc; | ||
1936 | void *data; | 1951 | void *data; |
1937 | size_t size; | 1952 | size_t size; |
1938 | uint16_t type; | 1953 | uint16_t type; |
1954 | int droppable; | ||
1939 | 1955 | ||
1940 | size = ntohs (message->size); | 1956 | size = ntohs (message->size); |
1941 | data = GNUNET_malloc (size); | 1957 | data = GNUNET_malloc (size); |
@@ -1944,6 +1960,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1944 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u) on connection %s\n", | 1960 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u) on connection %s\n", |
1945 | GNUNET_MESH_DEBUG_M2S (type), size, GNUNET_h2s (&c->id)); | 1961 | GNUNET_MESH_DEBUG_M2S (type), size, GNUNET_h2s (&c->id)); |
1946 | 1962 | ||
1963 | droppable = GNUNET_YES; | ||
1947 | switch (type) | 1964 | switch (type) |
1948 | { | 1965 | { |
1949 | struct GNUNET_MESH_Encrypted *emsg; | 1966 | struct GNUNET_MESH_Encrypted *emsg; |
@@ -1972,6 +1989,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1972 | amsg = (struct GNUNET_MESH_ACK *) data; | 1989 | amsg = (struct GNUNET_MESH_ACK *) data; |
1973 | amsg->cid = c->id; | 1990 | amsg->cid = c->id; |
1974 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack)); | 1991 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack)); |
1992 | droppable = GNUNET_NO; | ||
1975 | break; | 1993 | break; |
1976 | 1994 | ||
1977 | case GNUNET_MESSAGE_TYPE_MESH_POLL: | 1995 | case GNUNET_MESSAGE_TYPE_MESH_POLL: |
@@ -1979,6 +1997,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1979 | pmsg->cid = c->id; | 1997 | pmsg->cid = c->id; |
1980 | pmsg->pid = htonl (fwd ? c->fwd_fc.last_pid_sent : c->bck_fc.last_pid_sent); | 1998 | pmsg->pid = htonl (fwd ? c->fwd_fc.last_pid_sent : c->bck_fc.last_pid_sent); |
1981 | LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid)); | 1999 | LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid)); |
2000 | droppable = GNUNET_NO; | ||
1982 | break; | 2001 | break; |
1983 | 2002 | ||
1984 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: | 2003 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: |
@@ -2001,8 +2020,30 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2001 | GNUNET_break (0); | 2020 | GNUNET_break (0); |
2002 | } | 2021 | } |
2003 | 2022 | ||
2023 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
2024 | if (fc->queue_n >= fc->queue_max && droppable) | ||
2025 | { | ||
2026 | GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)", | ||
2027 | 1, GNUNET_NO); | ||
2028 | GNUNET_break (0); | ||
2029 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2030 | "queue full: %u/%u\n", | ||
2031 | fc->queue_n, fc->queue_max); | ||
2032 | return; /* Drop this message */ | ||
2033 | } | ||
2034 | |||
2035 | LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid %u\n", fc->last_pid_sent); | ||
2036 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", fc->last_ack_recv); | ||
2037 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n); | ||
2038 | if (GMC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) | ||
2039 | { | ||
2040 | GMC_start_poll (c, fwd); | ||
2041 | } | ||
2042 | fc->queue_n++; | ||
2043 | c->pending_messages++; | ||
2044 | |||
2004 | GMP_queue_add (get_hop (c, fwd), data, type, size, c, ch, fwd, | 2045 | GMP_queue_add (get_hop (c, fwd), data, type, size, c, ch, fwd, |
2005 | &message_sent, (void *) size); | 2046 | &message_sent, NULL); |
2006 | } | 2047 | } |
2007 | 2048 | ||
2008 | 2049 | ||
@@ -2023,10 +2064,8 @@ enum MeshTunnel3State state; | |||
2023 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n"); | 2064 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n"); |
2024 | GMP_queue_add (get_next_hop (connection), NULL, | 2065 | GMP_queue_add (get_next_hop (connection), NULL, |
2025 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, | 2066 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, |
2026 | size, | 2067 | size, connection, NULL, |
2027 | connection, | 2068 | GNUNET_YES, &message_sent, NULL); |
2028 | NULL, | ||
2029 | GNUNET_YES, &message_sent, (void *) size); | ||
2030 | state = GMT_get_state (connection->t); | 2069 | state = GMT_get_state (connection->t); |
2031 | if (MESH_TUNNEL3_SEARCHING == state || MESH_TUNNEL3_NEW == state) | 2070 | if (MESH_TUNNEL3_SEARCHING == state || MESH_TUNNEL3_NEW == state) |
2032 | GMT_change_state (connection->t, MESH_TUNNEL3_WAITING); | 2071 | GMT_change_state (connection->t, MESH_TUNNEL3_WAITING); |
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 6d87960b5..f997cf838 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -768,7 +768,6 @@ static size_t | |||
768 | queue_send (void *cls, size_t size, void *buf) | 768 | queue_send (void *cls, size_t size, void *buf) |
769 | { | 769 | { |
770 | struct MeshPeer *peer = cls; | 770 | struct MeshPeer *peer = cls; |
771 | struct MeshFlowControl *fc; | ||
772 | struct MeshConnection *c; | 771 | struct MeshConnection *c; |
773 | struct GNUNET_MessageHeader *msg; | 772 | struct GNUNET_MessageHeader *msg; |
774 | struct MeshPeerQueue *queue; | 773 | struct MeshPeerQueue *queue; |
@@ -798,7 +797,6 @@ queue_send (void *cls, size_t size, void *buf) | |||
798 | } | 797 | } |
799 | c = queue->c; | 798 | c = queue->c; |
800 | fwd = queue->fwd; | 799 | fwd = queue->fwd; |
801 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
802 | 800 | ||
803 | dst_id = GNUNET_PEER_resolve2 (peer->id); | 801 | dst_id = GNUNET_PEER_resolve2 (peer->id); |
804 | LOG (GNUNET_ERROR_TYPE_DEBUG, "* towards %s\n", GNUNET_i2s (dst_id)); | 802 | LOG (GNUNET_ERROR_TYPE_DEBUG, "* towards %s\n", GNUNET_i2s (dst_id)); |
@@ -825,7 +823,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
825 | /* Fill buf */ | 823 | /* Fill buf */ |
826 | switch (queue->type) | 824 | switch (queue->type) |
827 | { | 825 | { |
828 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY: | 826 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: |
829 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: | 827 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: |
830 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: | 828 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: |
831 | case GNUNET_MESSAGE_TYPE_MESH_FWD: | 829 | case GNUNET_MESSAGE_TYPE_MESH_FWD: |
@@ -877,14 +875,6 @@ queue_send (void *cls, size_t size, void *buf) | |||
877 | data_size = 0; | 875 | data_size = 0; |
878 | } | 876 | } |
879 | 877 | ||
880 | if (NULL != queue->callback) | ||
881 | { | ||
882 | LOG (GNUNET_ERROR_TYPE_DEBUG, "* Calling callback\n"); | ||
883 | queue->callback (queue->callback_cls, | ||
884 | queue->c, | ||
885 | GNUNET_TIME_absolute_get_duration (queue->start_waiting)); | ||
886 | } | ||
887 | |||
888 | /* Free queue, but cls was freed by send_core_* */ | 878 | /* Free queue, but cls was freed by send_core_* */ |
889 | ch = queue->ch; | 879 | ch = queue->ch; |
890 | GMP_queue_destroy (queue, GNUNET_NO); | 880 | GMP_queue_destroy (queue, GNUNET_NO); |
@@ -940,22 +930,13 @@ queue_send (void *cls, size_t size, void *buf) | |||
940 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 930 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; |
941 | } | 931 | } |
942 | } | 932 | } |
943 | if (NULL != c) | ||
944 | { | ||
945 | c->pending_messages--; | ||
946 | if (GNUNET_YES == c->destroy && 0 == c->pending_messages) | ||
947 | { | ||
948 | LOG (GNUNET_ERROR_TYPE_DEBUG, "* destroying connection!\n"); | ||
949 | GMC_destroy (c); | ||
950 | } | ||
951 | } | ||
952 | 933 | ||
953 | if (NULL != t) | 934 | if (NULL != t) |
954 | { | 935 | { |
955 | t->pending_messages--; | 936 | t->pending_messages--; |
956 | if (GNUNET_YES == t->destroy && 0 == t->pending_messages) | 937 | if (GNUNET_YES == t->destroy && 0 == t->pending_messages) |
957 | { | 938 | { |
958 | // LOG (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n"); | 939 | LOG (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n"); |
959 | GMT_destroy (t); | 940 | GMT_destroy (t); |
960 | } | 941 | } |
961 | } | 942 | } |
@@ -1021,24 +1002,19 @@ void | |||
1021 | GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | 1002 | GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls) |
1022 | { | 1003 | { |
1023 | struct MeshPeer *peer; | 1004 | struct MeshPeer *peer; |
1024 | struct MeshFlowControl *fc; | ||
1025 | int fwd; | ||
1026 | 1005 | ||
1027 | fwd = queue->fwd; | ||
1028 | peer = queue->peer; | 1006 | peer = queue->peer; |
1029 | GNUNET_assert (NULL != queue->c); | 1007 | GNUNET_assert (NULL != queue->c); |
1030 | fc = fwd ? &queue->c->fwd_fc : &queue->c->bck_fc; | ||
1031 | 1008 | ||
1032 | if (GNUNET_YES == clear_cls) | 1009 | if (GNUNET_YES == clear_cls) |
1033 | { | 1010 | { |
1034 | LOG (GNUNET_ERROR_TYPE_DEBUG, " queue destroy type %s\n", | 1011 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# queue destroy type %s\n", |
1035 | GNUNET_MESH_DEBUG_M2S (queue->type)); | 1012 | GNUNET_MESH_DEBUG_M2S (queue->type)); |
1036 | switch (queue->type) | 1013 | switch (queue->type) |
1037 | { | 1014 | { |
1038 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: | 1015 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: |
1039 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY: | 1016 | case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: |
1040 | LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n"); | 1017 | LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n"); |
1041 | GNUNET_break (GNUNET_YES == queue->c->destroy); | ||
1042 | /* fall through */ | 1018 | /* fall through */ |
1043 | case GNUNET_MESSAGE_TYPE_MESH_FWD: | 1019 | case GNUNET_MESSAGE_TYPE_MESH_FWD: |
1044 | case GNUNET_MESSAGE_TYPE_MESH_BCK: | 1020 | case GNUNET_MESSAGE_TYPE_MESH_BCK: |
@@ -1047,33 +1023,31 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
1047 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: | 1023 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: |
1048 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: | 1024 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: |
1049 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: | 1025 | case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: |
1050 | LOG (GNUNET_ERROR_TYPE_DEBUG, " prebuilt message\n");; | 1026 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# prebuilt message\n");; |
1051 | GNUNET_free_non_null (queue->cls); | 1027 | GNUNET_free_non_null (queue->cls); |
1052 | break; | 1028 | break; |
1053 | 1029 | ||
1054 | default: | 1030 | default: |
1055 | GNUNET_break (0); | 1031 | GNUNET_break (0); |
1056 | LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n", | 1032 | LOG (GNUNET_ERROR_TYPE_ERROR, "# type %s unknown!\n", |
1057 | GNUNET_MESH_DEBUG_M2S (queue->type)); | 1033 | GNUNET_MESH_DEBUG_M2S (queue->type)); |
1058 | } | 1034 | } |
1059 | |||
1060 | } | 1035 | } |
1061 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); | 1036 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); |
1062 | 1037 | ||
1063 | if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK && | 1038 | if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK && |
1064 | queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL) | 1039 | queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL) |
1065 | { | 1040 | { |
1066 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N- %p %u\n", fc, fc->queue_n); | ||
1067 | fc->queue_n--; | ||
1068 | peer->queue_n--; | 1041 | peer->queue_n--; |
1069 | } | 1042 | } |
1070 | if (NULL != queue->c) | 1043 | |
1044 | if (NULL != queue->callback) | ||
1071 | { | 1045 | { |
1072 | queue->c->pending_messages--; | 1046 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# Calling callback\n"); |
1073 | if (NULL != queue->c->t) | 1047 | queue->callback (queue->callback_cls, |
1074 | { | 1048 | queue->c, queue->type, |
1075 | queue->c->t->pending_messages--; | 1049 | queue->fwd, queue->size, |
1076 | } | 1050 | GNUNET_TIME_absolute_get_duration (queue->start_waiting)); |
1077 | } | 1051 | } |
1078 | 1052 | ||
1079 | GNUNET_free (queue); | 1053 | GNUNET_free (queue); |
@@ -1124,34 +1098,8 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size, | |||
1124 | } | 1098 | } |
1125 | 1099 | ||
1126 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); | 1100 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); |
1127 | LOG (GNUNET_ERROR_TYPE_DEBUG, "fc %p\n", fc); | ||
1128 | if (fc->queue_n >= fc->queue_max && 0 == priority) | ||
1129 | { | ||
1130 | GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)", | ||
1131 | 1, GNUNET_NO); | ||
1132 | GNUNET_break (0); | ||
1133 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1134 | "queue full: %u/%u\n", | ||
1135 | fc->queue_n, fc->queue_max); | ||
1136 | return; /* Drop this message */ | ||
1137 | } | ||
1138 | 1101 | ||
1139 | LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid %u\n", fc->last_pid_sent); | 1102 | call_core = GMC_is_sendable (c, fwd); |
1140 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", fc->last_ack_recv); | ||
1141 | if (GMC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) | ||
1142 | { | ||
1143 | call_core = GNUNET_NO; | ||
1144 | if (GNUNET_SCHEDULER_NO_TASK == fc->poll_task && | ||
1145 | GNUNET_MESSAGE_TYPE_MESH_POLL != type) | ||
1146 | { | ||
1147 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1148 | "no buffer space (%u > %u): starting poll\n", | ||
1149 | fc->last_pid_sent + 1, fc->last_ack_recv); | ||
1150 | GMC_start_poll (c, fwd); | ||
1151 | } | ||
1152 | } | ||
1153 | else | ||
1154 | call_core = GNUNET_YES; | ||
1155 | queue = GNUNET_malloc (sizeof (struct MeshPeerQueue)); | 1103 | queue = GNUNET_malloc (sizeof (struct MeshPeerQueue)); |
1156 | queue->cls = cls; | 1104 | queue->cls = cls; |
1157 | queue->type = type; | 1105 | queue->type = type; |
@@ -1181,8 +1129,6 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size, | |||
1181 | else | 1129 | else |
1182 | { | 1130 | { |
1183 | GNUNET_CONTAINER_DLL_insert_tail (peer->queue_head, peer->queue_tail, queue); | 1131 | GNUNET_CONTAINER_DLL_insert_tail (peer->queue_head, peer->queue_tail, queue); |
1184 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n); | ||
1185 | fc->queue_n++; | ||
1186 | peer->queue_n++; | 1132 | peer->queue_n++; |
1187 | } | 1133 | } |
1188 | 1134 | ||
@@ -1209,9 +1155,6 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size, | |||
1209 | peer2s (peer)); | 1155 | peer2s (peer)); |
1210 | 1156 | ||
1211 | } | 1157 | } |
1212 | c->pending_messages++; | ||
1213 | if (NULL != c->t) | ||
1214 | c->t->pending_messages++; | ||
1215 | } | 1158 | } |
1216 | 1159 | ||
1217 | 1160 | ||
diff --git a/src/mesh/gnunet-service-mesh_peer.h b/src/mesh/gnunet-service-mesh_peer.h index abc45f0c9..c7265ce2f 100644 --- a/src/mesh/gnunet-service-mesh_peer.h +++ b/src/mesh/gnunet-service-mesh_peer.h | |||
@@ -50,10 +50,14 @@ struct MeshPeer; | |||
50 | * | 50 | * |
51 | * @param cls Closure. | 51 | * @param cls Closure. |
52 | * @param c Connection this message was on. | 52 | * @param c Connection this message was on. |
53 | * @param type Type of message sent. | ||
54 | * @param fwd Was this a FWD going message? | ||
55 | * @param size Size of the message. | ||
53 | * @param wait Time spent waiting for core (only the time for THIS message) | 56 | * @param wait Time spent waiting for core (only the time for THIS message) |
54 | */ | 57 | */ |
55 | typedef void (*GMP_sent) (void *cls, | 58 | typedef void (*GMP_sent) (void *cls, |
56 | struct MeshConnection *c, | 59 | struct MeshConnection *c, uint16_t type, |
60 | int fwd, size_t size, | ||
57 | struct GNUNET_TIME_Relative wait); | 61 | struct GNUNET_TIME_Relative wait); |
58 | 62 | ||
59 | #include "gnunet-service-mesh_connection.h" | 63 | #include "gnunet-service-mesh_connection.h" |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 286eca618..c5ccc9f5c 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1151,6 +1151,7 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1151 | } | 1151 | } |
1152 | msg->reserved = 0; | 1152 | msg->reserved = 0; |
1153 | 1153 | ||
1154 | t->pending_messages++; | ||
1154 | GMC_send_prebuilt_message (&msg->header, c, ch, fwd); | 1155 | GMC_send_prebuilt_message (&msg->header, c, ch, fwd); |
1155 | } | 1156 | } |
1156 | 1157 | ||