aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-19 23:00:33 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-19 23:00:33 +0000
commit0f0ff0d2f2bc0878f94d439e1a4bffddcaecb150 (patch)
tree7ca97e29150749f71e05b22b3e6e5b7246bdb533 /src/mesh
parentf8d053e3db33e6874e7557331aad1a0aba4de830 (diff)
downloadgnunet-0f0ff0d2f2bc0878f94d439e1a4bffddcaecb150.tar.gz
gnunet-0f0ff0d2f2bc0878f94d439e1a4bffddcaecb150.zip
Fixed #2088, don't call receive_done on traffic not generated by client. Improved debug output.
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 0739e0d7d..79c6cb1b3 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -2104,11 +2104,13 @@ tunnel_send_multicast_iterator (void *cls, GNUNET_PEER_Id neighbor_id)
2104 * down the local one in the tunnel tree. 2104 * down the local one in the tunnel tree.
2105 * 2105 *
2106 * @param t Tunnel in which to send the data. 2106 * @param t Tunnel in which to send the data.
2107 * @param msg Message to be sent 2107 * @param msg Message to be sent.
2108 * @param internal Has the service generated this message?
2108 */ 2109 */
2109static void 2110static void
2110tunnel_send_multicast (struct MeshTunnel *t, 2111tunnel_send_multicast (struct MeshTunnel *t,
2111 const struct GNUNET_MessageHeader *msg) 2112 const struct GNUNET_MessageHeader *msg,
2113 int internal)
2112{ 2114{
2113 struct MeshData *mdata; 2115 struct MeshData *mdata;
2114 2116
@@ -2137,7 +2139,8 @@ tunnel_send_multicast (struct MeshTunnel *t,
2137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n"); 2139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n");
2138#endif 2140#endif
2139 } 2141 }
2140 if (NULL != t->client && GNUNET_YES != t->client->shutting_down) 2142 if (NULL != t->client && GNUNET_YES != t->client->shutting_down
2143 && GNUNET_NO == internal)
2141 { 2144 {
2142 mdata->task = GNUNET_malloc (sizeof (GNUNET_SCHEDULER_TaskIdentifier)); 2145 mdata->task = GNUNET_malloc (sizeof (GNUNET_SCHEDULER_TaskIdentifier));
2143 (*(mdata->task)) = 2146 (*(mdata->task)) =
@@ -2184,7 +2187,7 @@ tunnel_send_destroy (struct MeshTunnel *t)
2184 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY); 2187 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
2185 GNUNET_PEER_resolve (t->id.oid, &msg.oid); 2188 GNUNET_PEER_resolve (t->id.oid, &msg.oid);
2186 msg.tid = htonl (t->id.tid); 2189 msg.tid = htonl (t->id.tid);
2187 tunnel_send_multicast (t, &msg.header); 2190 tunnel_send_multicast (t, &msg.header, GNUNET_NO);
2188} 2191}
2189 2192
2190 2193
@@ -3056,7 +3059,7 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3056 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "MESH: TTL is 0, DROPPING!\n"); 3059 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "MESH: TTL is 0, DROPPING!\n");
3057 return GNUNET_OK; 3060 return GNUNET_OK;
3058 } 3061 }
3059 tunnel_send_multicast (t, message); 3062 tunnel_send_multicast (t, message, GNUNET_NO);
3060 return GNUNET_OK; 3063 return GNUNET_OK;
3061} 3064}
3062 3065
@@ -3347,7 +3350,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3347 payload = (struct GNUNET_MessageHeader *) &msg[1]; 3350 payload = (struct GNUNET_MessageHeader *) &msg[1];
3348 payload->size = htons (sizeof (struct GNUNET_MessageHeader)); 3351 payload->size = htons (sizeof (struct GNUNET_MessageHeader));
3349 payload->type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE); 3352 payload->type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE);
3350 tunnel_send_multicast (t, &msg->header); 3353 tunnel_send_multicast (t, &msg->header, GNUNET_YES);
3351 3354
3352 t->path_refresh_task = 3355 t->path_refresh_task =
3353 GNUNET_SCHEDULER_add_delayed (REFRESH_PATH_TIME, &path_refresh, t); 3356 GNUNET_SCHEDULER_add_delayed (REFRESH_PATH_TIME, &path_refresh, t);
@@ -3573,8 +3576,7 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client,
3573 c = GNUNET_malloc (sizeof (struct MeshClient)); 3576 c = GNUNET_malloc (sizeof (struct MeshClient));
3574#if MESH_DEBUG 3577#if MESH_DEBUG
3575 c->id = next_client_id++; 3578 c->id = next_client_id++;
3576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: CLIENT NEW %u at %p\n", c->id, 3579 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: CLIENT NEW %u\n", c->id);
3577 c);
3578#endif 3580#endif
3579 c->handle = client; 3581 c->handle = client;
3580 GNUNET_SERVER_client_keep (client); 3582 GNUNET_SERVER_client_keep (client);
@@ -3588,7 +3590,9 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client,
3588 for (i = 0; i < napps; i++) 3590 for (i = 0; i < napps; i++)
3589 { 3591 {
3590 at = ntohl (a[i]); 3592 at = ntohl (a[i]);
3593#if MESH_DEBUG
3591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: app type: %u\n", at); 3594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: app type: %u\n", at);
3595#endif
3592 GNUNET_CRYPTO_hash (&at, sizeof (at), &hc); 3596 GNUNET_CRYPTO_hash (&at, sizeof (at), &hc);
3593 /* store in clients hashmap */ 3597 /* store in clients hashmap */
3594 GNUNET_CONTAINER_multihashmap_put (c->apps, &hc, c, 3598 GNUNET_CONTAINER_multihashmap_put (c->apps, &hc, c,
@@ -3612,6 +3616,9 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client,
3612 for (i = 0; i < ntypes; i++) 3616 for (i = 0; i < ntypes; i++)
3613 { 3617 {
3614 u16 = ntohs (t[i]); 3618 u16 = ntohs (t[i]);
3619#if MESH_DEBUG
3620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: msg type: %u\n", u16);
3621#endif
3615 GNUNET_CRYPTO_hash (&u16, sizeof (u16), &hc); 3622 GNUNET_CRYPTO_hash (&u16, sizeof (u16), &hc);
3616 3623
3617 /* store in clients hashmap */ 3624 /* store in clients hashmap */