diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-05-02 10:59:03 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-05-02 10:59:03 +0000 |
commit | 4aea44167099630dd9e92166b8c319cffa3e7b31 (patch) | |
tree | e5dd4b88ad4640dee1deff0513d434d107bd2538 /src/mesh | |
parent | c48a63ae7892a19ff7c7a06b04ef5400858cea76 (diff) | |
download | gnunet-4aea44167099630dd9e92166b8c319cffa3e7b31.tar.gz gnunet-4aea44167099630dd9e92166b8c319cffa3e7b31.zip |
WiP
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index dcd7de9ff..6c70d9684 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -859,11 +859,11 @@ handle_local_connect_del (void *cls, | |||
859 | struct Client *c; | 859 | struct Client *c; |
860 | struct MESH_tunnel *t; | 860 | struct MESH_tunnel *t; |
861 | struct Path *p; | 861 | struct Path *p; |
862 | struct Path *aux; | 862 | struct Path *aux_path; |
863 | MESH_TunnelID tid; | 863 | MESH_TunnelID tid; |
864 | GNUNET_PEER_Id peer_id; | 864 | GNUNET_PEER_Id peer_id; |
865 | struct PeerInfo *peer_info; | 865 | struct PeerInfo *peer_info; |
866 | int i; | 866 | struct PeerInfo *aux_peer_info; |
867 | 867 | ||
868 | /* Sanity check for client registration */ | 868 | /* Sanity check for client registration */ |
869 | if(NULL == (c = client_retrieve(client))) { | 869 | if(NULL == (c = client_retrieve(client))) { |
@@ -905,18 +905,18 @@ handle_local_connect_del (void *cls, | |||
905 | return; | 905 | return; |
906 | } | 906 | } |
907 | 907 | ||
908 | /* Ok, delete peer from tunnel */ | 908 | /* Ok, delete peer from tunnel */ |
909 | p = t->paths_head; | 909 | p = t->paths_head; |
910 | peer_id = GNUNET_PEER_intern(&peer_msg->peer); | 910 | peer_id = GNUNET_PEER_intern(&peer_msg->peer); |
911 | |||
912 | /* Delete paths */ | ||
911 | while(p != NULL) { | 913 | while(p != NULL) { |
912 | if(p->peers[p->length-1] == peer_id) { | 914 | if(p->peers[p->length-1] == peer_id) { |
913 | GNUNET_CONTAINER_DLL_remove(t->paths_head, t->paths_tail, p); | 915 | GNUNET_CONTAINER_DLL_remove(t->paths_head, t->paths_tail, p); |
914 | for(i = 0; i < p->length; i++) { | 916 | GNUNET_PEER_decrement_rcs(p->peers, p->length); |
915 | GNUNET_PEER_change_rc(p->peers[i], -1); | 917 | aux_path = p; |
916 | } | ||
917 | aux = p; | ||
918 | p = p->next; | 918 | p = p->next; |
919 | GNUNET_free(aux); | 919 | GNUNET_free(aux_path); |
920 | } else { | 920 | } else { |
921 | p = p->next; | 921 | p = p->next; |
922 | } | 922 | } |
@@ -924,6 +924,25 @@ handle_local_connect_del (void *cls, | |||
924 | break; | 924 | break; |
925 | } | 925 | } |
926 | } | 926 | } |
927 | |||
928 | /*Delete peer info */ | ||
929 | peer_info = t->peers_head; | ||
930 | while(peer_info != NULL) { | ||
931 | if(peer_info->id == peer_id) { | ||
932 | GNUNET_CONTAINER_DLL_remove(t->peers_head, | ||
933 | t->peers_tail, | ||
934 | peer_info); | ||
935 | aux_peer_info = peer_info; | ||
936 | peer_info = peer_info->next; | ||
937 | GNUNET_free(aux_peer_info); | ||
938 | } else { | ||
939 | peer_info = peer_info->next; | ||
940 | } | ||
941 | if(peer_info == t->peers_head) { | ||
942 | break; | ||
943 | } | ||
944 | } | ||
945 | |||
927 | GNUNET_PEER_change_rc(peer_id, -1); | 946 | GNUNET_PEER_change_rc(peer_id, -1); |
928 | 947 | ||
929 | GNUNET_SERVER_receive_done(client, GNUNET_OK); | 948 | GNUNET_SERVER_receive_done(client, GNUNET_OK); |