mmsg->header.size = htons (msize - sizeof (struct PendingMessage));
mmsg->header.type = htons (mtype);
mmsg->expiration = GNUNET_TIME_absolute_hton(exp);
+ memcpy (&mmsg->key, key, sizeof (GNUNET_HashCode));
+ mmsg->put_path_length = htonl(putl);
+ mmsg->get_path_length = htonl(getl);
path = (struct GNUNET_PeerIdentity *) &mmsg[1];
- memcpy (path, put_path, putl * sizeof (struct GNUNET_PeerIdentity));
- path = &path[putl];
- memcpy (path, get_path, getl * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&path[getl], data, size);
+ if (putl > 0)
+ {
+ memcpy (path, put_path, putl * sizeof (struct GNUNET_PeerIdentity));
+ path = &path[putl];
+ }
+ if (getl > 0)
+ memcpy (path, get_path, getl * sizeof (struct GNUNET_PeerIdentity));
+ if (size > 0)
+ memcpy (&path[getl], data, size);
add_pending_message (m->client, pm);
}
}
unsigned int monitor_counter;
+int in_test;
+
/**
* Check whether peers successfully shut down.
*/
static void
do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ in_test = GNUNET_YES;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: looking for %s\n",
GNUNET_h2s_full (&d_far->id.hashPubKey));
const void *data,
size_t size)
{
+ const char *s_key;
+
+ s_key = GNUNET_h2s(key);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"%u got a message of type %u for key %s\n",
- cls, mtype, GNUNET_h2s (key));
- if (mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET ||
- mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT)
+ cls, mtype, s_key);
+
+ if ((mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET ||
+ mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT) &&
+ strncmp (s_key, id_far, 4) == 0 && in_test == GNUNET_YES)
monitor_counter++;
}
NULL
};
+ in_test = GNUNET_NO;
GNUNET_PROGRAM_run (sizeof (argv) / sizeof (char *) - 1, argv,
"test_dht_monitor",
gettext_noop ("Test dht monitoring in a small 2D torus."),