From 56a7b2b75c2b125212f948a20fb6c5e4af7459e1 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 30 Oct 2012 14:17:07 +0000 Subject: [PATCH] - refactoring --- src/mesh/gnunet-service-mesh-new.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index 37038177a..64f9beb13 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c @@ -2898,35 +2898,38 @@ peer_info_add_path_to_origin (struct MeshPeerInfo *peer_info, * Function called if the connection to the peer has been stalled for a while, * possibly due to a missed ACK. Poll the peer about its ACK status. * - * @param cls Closure (info about regex search). + * @param cls Closure (MeshPeerInfo of stalled peer). * @param tc TaskContext. */ static void tunnel_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - struct MeshTunnelChildInfo *cinfo = cls; + struct MeshTunnelFlowControlInfo *fcinfo = cls; struct GNUNET_MESH_Poll msg; struct GNUNET_PeerIdentity id; struct MeshTunnel *t; - return; // FIXME fc activate - cinfo->fc_poll = GNUNET_SCHEDULER_NO_TASK; + // FIXME fc include code to poll clients + if (NULL == fcinfo->peer) + return; + fcinfo->fc_poll = GNUNET_SCHEDULER_NO_TASK; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { return; } - t = cinfo->t; + t = fcinfo->t; msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); msg.header.size = htons (sizeof (msg)); msg.tid = htonl (t->id.tid); GNUNET_PEER_resolve (t->id.oid, &msg.oid); - msg.last_ack = htonl (cinfo->fwd_ack); + msg.last_ack = htonl (fcinfo->fwd_ack); + + GNUNET_PEER_resolve (fcinfo->peer->id, &id); + send_prebuilt_message (&msg.header, &id, fcinfo->t); + fcinfo->fc_poll = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, + &tunnel_poll, fcinfo); - GNUNET_PEER_resolve (tree_get_predecessor(cinfo->t->tree), &id); - send_prebuilt_message (&msg.header, &id, cinfo->t); - cinfo->fc_poll = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, - &tunnel_poll, cinfo); } -- 2.25.1