*/
static int res_cb_wo_fo;
+struct GNUNET_PeerIdentity pid;
+
GNUNET_SCHEDULER_TaskIdentifier timeout_task;
if (NULL != peer)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received callback for peer `%s' %s HELLO\n",
+ GNUNET_i2s (peer),
+ (NULL != hello) ? "with" : "without");
+
if (NULL == hello)
return;
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO\n",
- (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ? "friend only" : "public");
- res_cb_w_fo = GNUNET_YES;
- GNUNET_SCHEDULER_add_now(&done, NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO for peer `%s'\n",
+ (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ? "friend only" : "public",
+ GNUNET_i2s (peer));
+ if (0 == memcmp (&pid, peer, sizeof (pid)))
+ {
+ res_cb_w_fo = GNUNET_YES;
+ GNUNET_SCHEDULER_add_now(&done, NULL);
+ }
return;
}
}
if (NULL != peer)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received callback for peer `%s' %s HELLO\n",
+ GNUNET_i2s (peer),
+ (NULL != hello) ? "with" : "without");
+
if (NULL == hello)
return;
- GNUNET_break (0);
-
if (GNUNET_YES == GNUNET_HELLO_is_friend_only(hello))
{
GNUNET_break (0);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO\n",
- (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ? "friend only" : "public");
- res_cb_wo_fo = GNUNET_YES;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO for peer `%s'\n",
+ (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ? "friend only" : "public",
+ GNUNET_i2s (peer));
+ if (0 == memcmp (&pid, peer, sizeof (pid)))
+ {
+ GNUNET_break (0);
+ res_cb_wo_fo = GNUNET_YES;
+ }
}
}
{
if (NULL == emsg)
{
- pnc_w_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_YES, &process_w_fo, NULL);
- pnc_wo_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_NO, &process_wo_fo, NULL);
return;
}
else
static void
add_peer ()
{
- struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pkey;
- struct GNUNET_PeerIdentity pid;
struct GNUNET_HELLO_Message *h2;
size_t agc;
agc = 2;
- memset (&pkey, 32, sizeof (pkey));
- GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
- h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc, GNUNET_YES);
+ memset (&pid, 32, sizeof (pid));
+ h2 = GNUNET_HELLO_create (&pid.public_key, &address_generator, &agc, GNUNET_YES);
GNUNET_PEERINFO_add_peer (h, h2, &add_peer_done, NULL);
GNUNET_free (h2);
static void
-run (void *cls,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Peer *peer)
{
timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
mycfg = cfg;
+ pnc_w_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_YES, &process_w_fo, NULL);
+ pnc_wo_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_NO, &process_wo_fo, NULL);
h = GNUNET_PEERINFO_connect (cfg);
GNUNET_assert (NULL != h);
add_peer ();