struct GSF_PendingRequest *pr)
{
struct GSF_ConnectedPeer *cp = cls;
+ struct GNUNET_PeerIdentity pid;
+ GSF_connected_peer_get_identity_ (cp, &pid);
+ if (GNUNET_YES !=
+ GSF_pending_request_test_target_ (pr,
+ &pid))
+ return GNUNET_YES;
GSF_plan_add_ (cp, pr);
return GNUNET_YES;
}
plan (pp, rp);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
- ("# queries messages sent to other peers"), 1,
+ ("# query messages sent to other peers"), 1,
GNUNET_NO);
return msize;
}
}
+/**
+ * Is the given target a legitimate peer for forwarding the given request?
+ *
+ * @param pr request
+ * @param target
+ * @return GNUNET_YES if this request could be forwarded to the given peer
+ */
+int
+GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr,
+ const struct GNUNET_PeerIdentity *target)
+{
+ struct GNUNET_PeerIdentity pi;
+
+ if (0 == pr->sender_pid)
+ return GNUNET_YES;
+ GNUNET_PEER_resolve (pr->sender_pid, &pi);
+ return (0 == memcmp (&pi, target, sizeof (struct GNUNET_PeerIdentity))) ? GNUNET_NO :GNUNET_YES;
+}
+
+
/**
* Look up the request in the local datastore.
*
GSF_LocalLookupContinuation cont, void *cont_cls);
+/**
+ * Is the given target a legitimate peer for forwarding the given request?
+ *
+ * @param pr request
+ * @param target
+ * @return GNUNET_YES if this request could be forwarded to the given peer
+ */
+int
+GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr,
+ const struct GNUNET_PeerIdentity *target);
+
+
+
/**
* Setup the subsystem.
*/