From: Bart Polot Date: Wed, 21 Sep 2011 22:39:11 +0000 (+0000) Subject: Added notification when peers go offline during a path change X-Git-Tag: initial-import-from-subversion-38251~16976 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1e018e4e2e1d57cee223aa84f2ebd7e6c8160480;p=oweals%2Fgnunet.git Added notification when peers go offline during a path change --- 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); }