diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh-enc.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index a1e08e7d5..ce3cce32c 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -5711,9 +5711,9 @@ handle_local_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
5711 | const struct GNUNET_MessageHeader *message) | 5711 | const struct GNUNET_MessageHeader *message) |
5712 | { | 5712 | { |
5713 | struct GNUNET_MESH_LocalAck *msg; | 5713 | struct GNUNET_MESH_LocalAck *msg; |
5714 | struct MeshTunnel *t; | 5714 | struct MeshChannel *ch; |
5715 | struct MeshClient *c; | 5715 | struct MeshClient *c; |
5716 | MESH_ChannelNumber tid; | 5716 | MESH_ChannelNumber chid; |
5717 | 5717 | ||
5718 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n"); | 5718 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n"); |
5719 | /* Sanity check for client registration */ | 5719 | /* Sanity check for client registration */ |
@@ -5728,28 +5728,28 @@ handle_local_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
5728 | msg = (struct GNUNET_MESH_LocalAck *) message; | 5728 | msg = (struct GNUNET_MESH_LocalAck *) message; |
5729 | 5729 | ||
5730 | /* Tunnel exists? */ | 5730 | /* Tunnel exists? */ |
5731 | tid = ntohl (msg->channel_id); | 5731 | chid = ntohl (msg->channel_id); |
5732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on tunnel %X\n", tid); | 5732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid); |
5733 | t = channel_get_by_local_id (c, tid); | 5733 | ch = channel_get_by_local_id (c, chid); |
5734 | if (NULL == t) | 5734 | if (NULL == ch) |
5735 | { | 5735 | { |
5736 | GNUNET_break (0); | 5736 | GNUNET_break (0); |
5737 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tunnel %X unknown.\n", tid); | 5737 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Channel %X unknown.\n", chid); |
5738 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " for client %u.\n", c->id); | 5738 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " for client %u.\n", c->id); |
5739 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 5739 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
5740 | return; | 5740 | return; |
5741 | } | 5741 | } |
5742 | 5742 | ||
5743 | /* Does client own tunnel? I.E: Is this an ACK for BCK traffic? */ | 5743 | /* Does client own tunnel? I.E: Is this an ACK for BCK traffic? */ |
5744 | if (tid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) | 5744 | if (chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) |
5745 | { | 5745 | { |
5746 | /* The client owns the tunnel, ACK is for data to_origin, send BCK ACK. */ | 5746 | /* The client owns the channel, ACK is for data to_origin, send BCK ACK. */ |
5747 | t->prev_fc.last_ack_recv++; | 5747 | ch->prev_fc.last_ack_recv++; |
5748 | tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK, GNUNET_NO); | 5748 | tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK, GNUNET_NO); |
5749 | } | 5749 | } |
5750 | else | 5750 | else |
5751 | { | 5751 | { |
5752 | /* The client doesn't own the tunnel, this ACK is for FWD traffic. */ | 5752 | /* The client doesn't own the channel, this ACK is for FWD traffic. */ |
5753 | t->next_fc.last_ack_recv++; | 5753 | t->next_fc.last_ack_recv++; |
5754 | tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK, GNUNET_YES); | 5754 | tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK, GNUNET_YES); |
5755 | } | 5755 | } |
@@ -5760,7 +5760,6 @@ handle_local_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
5760 | } | 5760 | } |
5761 | 5761 | ||
5762 | 5762 | ||
5763 | |||
5764 | /** | 5763 | /** |
5765 | * Iterator over all tunnels to send a monitoring client info about each tunnel. | 5764 | * Iterator over all tunnels to send a monitoring client info about each tunnel. |
5766 | * | 5765 | * |
@@ -6089,36 +6088,6 @@ shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
6089 | return GNUNET_YES; | 6088 | return GNUNET_YES; |
6090 | } | 6089 | } |
6091 | 6090 | ||
6092 | /** | ||
6093 | * Iterator over peer hash map entries to destroy the tunnel during shutdown. | ||
6094 | * | ||
6095 | * @param cls closure | ||
6096 | * @param key current key code | ||
6097 | * @param value value in the hash map | ||
6098 | * @return GNUNET_YES if we should continue to iterate, | ||
6099 | * GNUNET_NO if not. | ||
6100 | */ | ||
6101 | static int | ||
6102 | shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value) | ||
6103 | { | ||
6104 | struct MeshPeer *p = value; | ||
6105 | struct MeshPeerQueue *q; | ||
6106 | struct MeshPeerQueue *n; | ||
6107 | |||
6108 | q = p->fc->queue_head; | ||
6109 | while (NULL != q) | ||
6110 | { | ||
6111 | n = q->next; | ||
6112 | if (q->peer == p) | ||
6113 | { | ||
6114 | queue_destroy(q, GNUNET_YES); | ||
6115 | } | ||
6116 | q = n; | ||
6117 | } | ||
6118 | peer_destroy (p); | ||
6119 | return GNUNET_YES; | ||
6120 | } | ||
6121 | |||
6122 | 6091 | ||
6123 | /** | 6092 | /** |
6124 | * Task run during shutdown. | 6093 | * Task run during shutdown. |
@@ -6137,7 +6106,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
6137 | core_handle = NULL; | 6106 | core_handle = NULL; |
6138 | } | 6107 | } |
6139 | GNUNET_CONTAINER_multihashmap_iterate (tunnels, &shutdown_tunnel, NULL); | 6108 | GNUNET_CONTAINER_multihashmap_iterate (tunnels, &shutdown_tunnel, NULL); |
6140 | GNUNET_CONTAINER_multihashmap_iterate (peers, &shutdown_peer, NULL); | ||
6141 | if (dht_handle != NULL) | 6109 | if (dht_handle != NULL) |
6142 | { | 6110 | { |
6143 | GNUNET_DHT_disconnect (dht_handle); | 6111 | GNUNET_DHT_disconnect (dht_handle); |