diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-09-16 17:53:31 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-09-16 17:53:31 +0000 |
commit | 98be109b2e59b634ceb5d459b6542aff5b5e2a7e (patch) | |
tree | 24515db0a499282fa30d10bbf9f0479465e2fdf1 /src | |
parent | 8e8c63b8f9cd8ce94d63e4c854f299c66bf32c6f (diff) | |
download | gnunet-98be109b2e59b634ceb5d459b6542aff5b5e2a7e.tar.gz gnunet-98be109b2e59b634ceb5d459b6542aff5b5e2a7e.zip |
Added notification of client that peers disconnected from tunnel
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index b84f07621..5002571ed 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -1132,6 +1132,32 @@ tunnel_find_peer(struct MeshTunnelPathNode *root, struct MeshPeerInfo *peer) | |||
1132 | 1132 | ||
1133 | 1133 | ||
1134 | /** | 1134 | /** |
1135 | * Recusively mark peer and children as disconnected, notify client | ||
1136 | * | ||
1137 | * @param parent Node to be clean, potentially with children | ||
1138 | */ | ||
1139 | static void | ||
1140 | tunnel_mark_peers_disconnected (struct MeshTunnelPathNode *parent) | ||
1141 | { | ||
1142 | struct GNUNET_MESH_PeerControl msg; | ||
1143 | unsigned int i; | ||
1144 | |||
1145 | parent->status = MESH_PEER_RECONNECTING; | ||
1146 | for (i = 0; i < parent->nchildren; i++) | ||
1147 | { | ||
1148 | tunnel_mark_peers_disconnected (&parent->children[i]); | ||
1149 | } | ||
1150 | if (NULL == parent->t->client) | ||
1151 | return; | ||
1152 | msg.header.size = htons(sizeof(msg)); | ||
1153 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL); | ||
1154 | msg.tunnel_id = htonl(parent->t->local_tid); | ||
1155 | GNUNET_PEER_resolve(parent->peer->id, &msg.peer); | ||
1156 | GNUNET_SERVER_notification_context_unicast (nc, parent->t->client->handle, | ||
1157 | &msg.header, GNUNET_NO); | ||
1158 | } | ||
1159 | |||
1160 | /** | ||
1135 | * Delete the current path to the peer, including all now unused relays. | 1161 | * Delete the current path to the peer, including all now unused relays. |
1136 | * | 1162 | * |
1137 | * @param t Tunnel where to add the new path. | 1163 | * @param t Tunnel where to add the new path. |
@@ -1166,6 +1192,9 @@ tunnel_del_path(struct MeshTunnel *t, struct MeshPeerInfo *peer) | |||
1166 | *n = parent->children[parent->nchildren - 1]; | 1192 | *n = parent->children[parent->nchildren - 1]; |
1167 | parent->nchildren--; | 1193 | parent->nchildren--; |
1168 | parent->children = GNUNET_realloc (parent->children, parent->nchildren); | 1194 | parent->children = GNUNET_realloc (parent->children, parent->nchildren); |
1195 | |||
1196 | tunnel_mark_peers_disconnected(node); | ||
1197 | |||
1169 | return node; | 1198 | return node; |
1170 | } | 1199 | } |
1171 | 1200 | ||
@@ -1247,7 +1276,6 @@ tunnel_add_path(struct MeshTunnel *t, struct MeshPeerPath *p) | |||
1247 | memcpy (n, oldnode, sizeof(struct MeshTunnelPathNode)); | 1276 | memcpy (n, oldnode, sizeof(struct MeshTunnelPathNode)); |
1248 | GNUNET_free (oldnode); | 1277 | GNUNET_free (oldnode); |
1249 | } | 1278 | } |
1250 | n->status = MESH_PEER_WAITING; | ||
1251 | } | 1279 | } |
1252 | else | 1280 | else |
1253 | { | 1281 | { |