diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-11 15:37:21 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-11 15:37:21 +0000 |
commit | 8f6c85fba2386a4e6673f07e32dbfefcfcffdd1c (patch) | |
tree | d525f468b2efcd39be2fc3062ea918bda7f1fbdc /src/mesh | |
parent | 2729dc7c819e58338e2f56531d44475198ebed6c (diff) | |
download | gnunet-8f6c85fba2386a4e6673f07e32dbfefcfcffdd1c.tar.gz gnunet-8f6c85fba2386a4e6673f07e32dbfefcfcffdd1c.zip |
- mesh builds again
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/Makefile.am | 4 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 26 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.h | 13 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 28 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.h | 11 |
5 files changed, 65 insertions, 17 deletions
diff --git a/src/mesh/Makefile.am b/src/mesh/Makefile.am index c8c09545f..df1c74c87 100644 --- a/src/mesh/Makefile.am +++ b/src/mesh/Makefile.am | |||
@@ -23,8 +23,8 @@ AM_CLFAGS = -g | |||
23 | EXP_LIB = \ | 23 | EXP_LIB = \ |
24 | libgnunetmeshenc.la | 24 | libgnunetmeshenc.la |
25 | 25 | ||
26 | #EXP_LIBEXEC = \ | 26 | EXP_LIBEXEC = \ |
27 | # gnunet-service-mesh-enc | 27 | gnunet-service-mesh-enc |
28 | 28 | ||
29 | libexec_PROGRAMS = \ | 29 | libexec_PROGRAMS = \ |
30 | gnunet-service-mesh $(EXP_LIBEXEC) | 30 | gnunet-service-mesh $(EXP_LIBEXEC) |
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 94813adf2..fbc021154 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -516,7 +516,8 @@ connection_send_ack (struct MeshConnection *c, unsigned int buffer, int fwd) | |||
516 | fwd ? "FWD" : "BCK", GNUNET_h2s (&c->id)); | 516 | fwd ? "FWD" : "BCK", GNUNET_h2s (&c->id)); |
517 | 517 | ||
518 | /* Check if we need to transmit the ACK */ | 518 | /* Check if we need to transmit the ACK */ |
519 | if (prev_fc->last_ack_sent - prev_fc->last_pid_recv > 3) | 519 | delta = prev_fc->last_ack_sent - prev_fc->last_pid_recv; |
520 | if (3 < delta && buffer < delta) | ||
520 | { | 521 | { |
521 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer > 3\n"); | 522 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer > 3\n"); |
522 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 523 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -526,8 +527,7 @@ connection_send_ack (struct MeshConnection *c, unsigned int buffer, int fwd) | |||
526 | } | 527 | } |
527 | 528 | ||
528 | /* Ok, ACK might be necessary, what PID to ACK? */ | 529 | /* Ok, ACK might be necessary, what PID to ACK? */ |
529 | delta = next_fc->queue_max - next_fc->queue_n; | 530 | ack = prev_fc->last_pid_recv + buffer; |
530 | ack = prev_fc->last_pid_recv + delta; | ||
531 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack); | 531 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack); |
532 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 532 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
533 | " last pid %u, last ack %u, qmax %u, q %u\n", | 533 | " last pid %u, last ack %u, qmax %u, q %u\n", |
@@ -1695,7 +1695,7 @@ GMC_send_ack (struct MeshConnection *c, struct MeshChannel *ch, int fwd) | |||
1695 | { | 1695 | { |
1696 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n"); | 1696 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n"); |
1697 | GNUNET_assert (NULL != ch); | 1697 | GNUNET_assert (NULL != ch); |
1698 | channel_send_connections_ack (ch, buffer, fwd); | 1698 | GMT_send_acks (GMCH_get_tunnel (ch), buffer, fwd); |
1699 | } | 1699 | } |
1700 | else | 1700 | else |
1701 | { | 1701 | { |
@@ -1751,6 +1751,7 @@ GMC_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1751 | void | 1751 | void |
1752 | GMC_shutdown (void) | 1752 | GMC_shutdown (void) |
1753 | { | 1753 | { |
1754 | GNUNET_CONTAINER_multihashmap_destroy (connections); | ||
1754 | } | 1755 | } |
1755 | 1756 | ||
1756 | 1757 | ||
@@ -1934,6 +1935,23 @@ GMC_get_qn (struct MeshConnection *c, int fwd) | |||
1934 | 1935 | ||
1935 | 1936 | ||
1936 | /** | 1937 | /** |
1938 | * Allow the connection to advertise a buffer of the given size. | ||
1939 | * | ||
1940 | * The connection will send an @c fwd ACK message (so: in direction !fwd) | ||
1941 | * allowing up to last_pid_recv + buffer. | ||
1942 | * | ||
1943 | * @param c Connection. | ||
1944 | * @param buffer How many more messages the connection can accept. | ||
1945 | * @param fwd Is this about FWD traffic? (The ack will go dest->root). | ||
1946 | */ | ||
1947 | void | ||
1948 | GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd) | ||
1949 | { | ||
1950 | connection_send_ack (c, buffer, fwd); | ||
1951 | } | ||
1952 | |||
1953 | |||
1954 | /** | ||
1937 | * Send a notification that a connection is broken. | 1955 | * Send a notification that a connection is broken. |
1938 | * | 1956 | * |
1939 | * @param c Connection that is broken. | 1957 | * @param c Connection that is broken. |
diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h index a617054ff..bdfaaf988 100644 --- a/src/mesh/gnunet-service-mesh_connection.h +++ b/src/mesh/gnunet-service-mesh_connection.h | |||
@@ -328,6 +328,19 @@ unsigned int | |||
328 | GMC_get_qn (struct MeshConnection *c, int fwd); | 328 | GMC_get_qn (struct MeshConnection *c, int fwd); |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * Allow the connection to advertise a buffer of the given size. | ||
332 | * | ||
333 | * The connection will send an @c fwd ACK message (so: in direction !fwd) | ||
334 | * allowing up to last_pid_recv + buffer. | ||
335 | * | ||
336 | * @param c Connection. | ||
337 | * @param buffer How many more messages the connection can accept. | ||
338 | * @param fwd Is this about FWD traffic? (The ack will go dest->root). | ||
339 | */ | ||
340 | void | ||
341 | GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd); | ||
342 | |||
343 | /** | ||
331 | * Send FWD keepalive packets for a connection. | 344 | * Send FWD keepalive packets for a connection. |
332 | * | 345 | * |
333 | * @param cls Closure (connection for which to send the keepalive). | 346 | * @param cls Closure (connection for which to send the keepalive). |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 105317501..01f581c27 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1095,10 +1095,8 @@ GMT_get_next_chid (struct MeshTunnel3 *t) | |||
1095 | * @param ch Channel which has some free buffer space. | 1095 | * @param ch Channel which has some free buffer space. |
1096 | * @param fwd Is this in for FWD traffic? (ACK goes dest->root) | 1096 | * @param fwd Is this in for FWD traffic? (ACK goes dest->root) |
1097 | */ | 1097 | */ |
1098 | static void | 1098 | void |
1099 | GMT_send_acks (struct MeshTunnel3 *t, | 1099 | GMT_send_acks (struct MeshTunnel3 *t, unsigned int buffer, int fwd) |
1100 | unsigned int buffer, | ||
1101 | int fwd) | ||
1102 | { | 1100 | { |
1103 | struct MeshTConnection *iter; | 1101 | struct MeshTConnection *iter; |
1104 | uint32_t allowed; | 1102 | uint32_t allowed; |
@@ -1108,7 +1106,19 @@ GMT_send_acks (struct MeshTunnel3 *t, | |||
1108 | 1106 | ||
1109 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1110 | "Tunnel send acks on %s:%X\n", | 1108 | "Tunnel send acks on %s:%X\n", |
1111 | fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid); | 1109 | fwd ? "FWD" : "BCK", GMT_2s (t)); |
1110 | |||
1111 | if (NULL == t) | ||
1112 | { | ||
1113 | GNUNET_break (0); | ||
1114 | return; | ||
1115 | } | ||
1116 | if (NULL == t->channel_head || | ||
1117 | GNUNET_NO == GMCH_is_origin (t->channel_head->ch, fwd)) | ||
1118 | { | ||
1119 | GNUNET_break (0); | ||
1120 | return; | ||
1121 | } | ||
1112 | 1122 | ||
1113 | /* Count connections, how many messages are already allowed */ | 1123 | /* Count connections, how many messages are already allowed */ |
1114 | cs = GMT_count_connections (t); | 1124 | cs = GMT_count_connections (t); |
@@ -1125,7 +1135,7 @@ GMT_send_acks (struct MeshTunnel3 *t, | |||
1125 | } | 1135 | } |
1126 | 1136 | ||
1127 | /* Authorize connections to send more data */ | 1137 | /* Authorize connections to send more data */ |
1128 | to_allow = buffer - allowed; | 1138 | to_allow = buffer; /* - allowed; */ |
1129 | 1139 | ||
1130 | for (iter = t->connection_head; NULL != iter && to_allow > 0; iter = iter->next) | 1140 | for (iter = t->connection_head; NULL != iter && to_allow > 0; iter = iter->next) |
1131 | { | 1141 | { |
@@ -1136,13 +1146,9 @@ GMT_send_acks (struct MeshTunnel3 *t, | |||
1136 | { | 1146 | { |
1137 | continue; | 1147 | continue; |
1138 | } | 1148 | } |
1139 | GMC_send_ack (iter->c, NULL, fwd); | 1149 | GMC_allow (iter->c, buffer, fwd); |
1140 | connection_send_ack (iter, allow_per_connection, fwd); | ||
1141 | } | 1150 | } |
1142 | 1151 | ||
1143 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1144 | "Channel send connection %s ack on %s:%X\n", | ||
1145 | fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid); | ||
1146 | GNUNET_break (to_allow == 0); | 1152 | GNUNET_break (to_allow == 0); |
1147 | } | 1153 | } |
1148 | 1154 | ||
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h index c5c13b28b..e15d07988 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.h +++ b/src/mesh/gnunet-service-mesh_tunnel.h | |||
@@ -310,6 +310,17 @@ MESH_ChannelNumber | |||
310 | GMT_get_next_chid (struct MeshTunnel3 *t); | 310 | GMT_get_next_chid (struct MeshTunnel3 *t); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | * Send ACK on one or more connections due to buffer space to the client. | ||
314 | * | ||
315 | * Iterates all connections of the tunnel and sends ACKs appropriately. | ||
316 | * | ||
317 | * @param ch Channel which has some free buffer space. | ||
318 | * @param fwd Is this in for FWD traffic? (ACK goes dest->root) | ||
319 | */ | ||
320 | void | ||
321 | GMT_send_acks (struct MeshTunnel3 *t, unsigned int buffer, int fwd); | ||
322 | |||
323 | /** | ||
313 | * Sends an already built message on a tunnel, encrypting it and | 324 | * Sends an already built message on a tunnel, encrypting it and |
314 | * choosing the best connection. | 325 | * choosing the best connection. |
315 | * | 326 | * |