diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-08-02 03:09:25 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-08-02 03:09:25 +0000 |
commit | cd91050ff520c04dde0a15473649379929eb35f1 (patch) | |
tree | 2652215e27de0a4c02d562f20a093447f08f43ab /src | |
parent | 5fd340ddc303679240ebb1c97bba1912309fc13c (diff) | |
download | gnunet-cd91050ff520c04dde0a15473649379929eb35f1.tar.gz gnunet-cd91050ff520c04dde0a15473649379929eb35f1.zip |
- fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 7d4e1685d..e2b6cf0ce 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -3381,6 +3381,7 @@ tunnel_new (struct GNUNET_HashCode *tid) | |||
3381 | 3381 | ||
3382 | t = GNUNET_new (struct MeshTunnel2); | 3382 | t = GNUNET_new (struct MeshTunnel2); |
3383 | t->id = *tid; | 3383 | t->id = *tid; |
3384 | t->next_chid = GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; | ||
3384 | if (GNUNET_OK != | 3385 | if (GNUNET_OK != |
3385 | GNUNET_CONTAINER_multihashmap_put (tunnels, tid, t, | 3386 | GNUNET_CONTAINER_multihashmap_put (tunnels, tid, t, |
3386 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 3387 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
@@ -5605,19 +5606,17 @@ monitor_all_tunnels_iterator (void *cls, | |||
5605 | void *value) | 5606 | void *value) |
5606 | { | 5607 | { |
5607 | struct GNUNET_SERVER_Client *client = cls; | 5608 | struct GNUNET_SERVER_Client *client = cls; |
5608 | struct MeshTunnel *t = value; | 5609 | struct MeshChannel *ch = value; |
5609 | struct GNUNET_MESH_LocalMonitor *msg; | 5610 | struct GNUNET_MESH_LocalMonitor *msg; |
5610 | 5611 | ||
5611 | msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor)); | 5612 | msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor)); |
5612 | GNUNET_PEER_resolve(t->id.oid, &msg->owner); | 5613 | msg->channel_id = htonl (ch->id); |
5613 | msg->channel_id = htonl (t->id.tid); | ||
5614 | msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); | 5614 | msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); |
5615 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); | 5615 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); |
5616 | GNUNET_PEER_resolve (t->dest, &msg->destination); | ||
5617 | 5616 | ||
5618 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 5617 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
5619 | "* sending info about tunnel %s [%u]\n", | 5618 | "* sending info about tunnel %s\n", |
5620 | GNUNET_i2s (&msg->owner), t->id.tid); | 5619 | GNUNET_i2s (&msg->owner)); |
5621 | 5620 | ||
5622 | GNUNET_SERVER_notification_context_unicast (nc, client, | 5621 | GNUNET_SERVER_notification_context_unicast (nc, client, |
5623 | &msg->header, GNUNET_NO); | 5622 | &msg->header, GNUNET_NO); |
@@ -5673,7 +5672,7 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, | |||
5673 | const struct GNUNET_MESH_LocalMonitor *msg; | 5672 | const struct GNUNET_MESH_LocalMonitor *msg; |
5674 | struct GNUNET_MESH_LocalMonitor *resp; | 5673 | struct GNUNET_MESH_LocalMonitor *resp; |
5675 | struct MeshClient *c; | 5674 | struct MeshClient *c; |
5676 | struct MeshTunnel *t; | 5675 | struct MeshChannel *ch; |
5677 | 5676 | ||
5678 | /* Sanity check for client registration */ | 5677 | /* Sanity check for client registration */ |
5679 | if (NULL == (c = client_get (client))) | 5678 | if (NULL == (c = client_get (client))) |
@@ -5689,10 +5688,10 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, | |||
5689 | c->id, | 5688 | c->id, |
5690 | &msg->owner, | 5689 | &msg->owner, |
5691 | ntohl (msg->channel_id)); | 5690 | ntohl (msg->channel_id)); |
5692 | t = channel_get (&msg->owner, ntohl (msg->channel_id)); | 5691 | ch = channel_get (&msg->owner, ntohl (msg->channel_id)); |
5693 | if (NULL == t) | 5692 | if (NULL == ch) |
5694 | { | 5693 | { |
5695 | /* We don't know the tunnel FIXME */ | 5694 | /* We don't know the tunnel */ |
5696 | struct GNUNET_MESH_LocalMonitor warn; | 5695 | struct GNUNET_MESH_LocalMonitor warn; |
5697 | 5696 | ||
5698 | warn = *msg; | 5697 | warn = *msg; |
@@ -5706,7 +5705,6 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, | |||
5706 | /* Initialize context */ | 5705 | /* Initialize context */ |
5707 | resp = GNUNET_malloc (sizeof (struct GNUNET_MESH_LocalMonitor)); | 5706 | resp = GNUNET_malloc (sizeof (struct GNUNET_MESH_LocalMonitor)); |
5708 | *resp = *msg; | 5707 | *resp = *msg; |
5709 | GNUNET_PEER_resolve (t->dest, &resp->destination); | ||
5710 | resp->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); | 5708 | resp->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); |
5711 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, | 5709 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, |
5712 | &resp->header, GNUNET_NO); | 5710 | &resp->header, GNUNET_NO); |
@@ -5726,7 +5724,7 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { | |||
5726 | {&handle_local_new_client, NULL, | 5724 | {&handle_local_new_client, NULL, |
5727 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, | 5725 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, |
5728 | {&handle_local_channel_create, NULL, | 5726 | {&handle_local_channel_create, NULL, |
5729 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CHANNEL_CREATE, | 5727 | GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE, |
5730 | sizeof (struct GNUNET_MESH_ChannelMessage)}, | 5728 | sizeof (struct GNUNET_MESH_ChannelMessage)}, |
5731 | {&handle_local_channel_destroy, NULL, | 5729 | {&handle_local_channel_destroy, NULL, |
5732 | GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY, | 5730 | GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY, |
@@ -5921,7 +5919,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
5921 | static int | 5919 | static int |
5922 | shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value) | 5920 | shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value) |
5923 | { | 5921 | { |
5924 | struct MeshTunnel *t = value; | 5922 | struct MeshTunnel2 *t = value; |
5925 | 5923 | ||
5926 | tunnel_destroy (t); | 5924 | tunnel_destroy (t); |
5927 | return GNUNET_YES; | 5925 | return GNUNET_YES; |
@@ -5943,7 +5941,7 @@ shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
5943 | struct MeshPeerQueue *q; | 5941 | struct MeshPeerQueue *q; |
5944 | struct MeshPeerQueue *n; | 5942 | struct MeshPeerQueue *n; |
5945 | 5943 | ||
5946 | q = p->queue_head; | 5944 | q = p->fc->queue_head; |
5947 | while (NULL != q) | 5945 | while (NULL != q) |
5948 | { | 5946 | { |
5949 | n = q->next; | 5947 | n = q->next; |
@@ -6132,7 +6130,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
6132 | } | 6130 | } |
6133 | 6131 | ||
6134 | tunnels = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); | 6132 | tunnels = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); |
6135 | incoming_tunnels = GNUNET_CONTAINER_multihashmap32_create (32); | ||
6136 | peers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); | 6133 | peers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); |
6137 | ports = GNUNET_CONTAINER_multihashmap32_create (32); | 6134 | ports = GNUNET_CONTAINER_multihashmap32_create (32); |
6138 | 6135 | ||
@@ -6174,8 +6171,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
6174 | GNUNET_SCHEDULER_shutdown (); | 6171 | GNUNET_SCHEDULER_shutdown (); |
6175 | return; | 6172 | return; |
6176 | } | 6173 | } |
6177 | next_tid = 0; | ||
6178 | next_local_tid = GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; | ||
6179 | announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id, cls); | 6174 | announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id, cls); |
6180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n"); | 6175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n"); |
6181 | } | 6176 | } |