+/**
+ * Core handler for mesh network traffic point-to-point ack polls.
+ *
+ * @param cls closure
+ * @param message message
+ * @param peer peer identity this notification is about
+ * @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+static int
+handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
+{
+ struct GNUNET_MESH_Poll *msg;
+ struct MeshTunnel *t;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an POLL packet from %s!\n",
+ GNUNET_i2s (peer));
+
+ msg = (struct GNUNET_MESH_Poll *) message;
+
+ t = tunnel_get (&msg->oid, ntohl (msg->tid));
+
+ if (NULL == t)
+ {
+ /* TODO notify that we dont know this tunnel (whom)? */
+ GNUNET_STATISTICS_update (stats, "# poll on unknown tunnel", 1, GNUNET_NO);
+ GNUNET_break_op (0);
+ return GNUNET_OK;
+ }
+
+ /* Is this a forward or backward ACK? */
+ if (tree_get_predecessor(t->tree) != GNUNET_PEER_search(peer))
+ {
+ struct MeshTunnelChildInfo *cinfo;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n");
+ cinfo = tunnel_get_neighbor_fc (t, peer);
+ cinfo->bck_ack = cinfo->fwd_pid; // mark as ready to send
+ tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from BCK\n");
+ tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
+ }
+
+ return GNUNET_OK;
+}
+
+