From 1e018e4e2e1d57cee223aa84f2ebd7e6c8160480 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 21 Sep 2011 22:39:11 +0000 Subject: [PATCH] Added notification when peers go offline during a path change --- src/mesh/gnunet-service-mesh.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 7ac577476..f39040851 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -1003,10 +1003,26 @@ tunnel_get (struct GNUNET_PeerIdentity *oid, MESH_TunnelNumber tid) } +/** + * Callback used to notify a client owner of a tunnel that a peer has + * disconnected, most likely because of a path change. + * + * @param n Node in the tree representing the disconnected peer + */ void notify_peer_disconnected (const struct MeshTunnelTreeNode *n) { - + struct GNUNET_MESH_PeerControl msg; + + if (NULL == n->t->client || NULL == nc) + return; + + msg.header.size = htons (sizeof (msg)); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL); + msg.tunnel_id = htonl (n->t->local_tid); + GNUNET_PEER_resolve (n->peer, &msg.peer); + GNUNET_SERVER_notification_context_unicast (nc, n->t->client->handle, + &msg.header, GNUNET_NO); } -- 2.25.1