r->key = GNUNET_malloc (sizeof (GNUNET_HashCode));
memcpy (r->key, &msg->key, sizeof (GNUNET_HashCode));
}
-
+ GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
+ // FIXME add remove somewhere
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
cl_size = 0;
for (m = monitor_head; NULL != m; m = m->next)
{
- if (m->type == type &&
+ if ((GNUNET_BLOCK_TYPE_ANY == m->type || m->type == type) &&
(NULL == m->key ||
memcmp (key, m->key, sizeof(GNUNET_HashCode)) == 0))
{
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);
}
}