- struct GNUNET_NAMESTORE_QueueEntry *qe;
- struct PendingMessage *pe;
- struct BlockCacheMessage *msg;
- uint32_t rid;
- size_t blen;
- size_t msg_size;
-
- GNUNET_assert (NULL != h);
- blen = ntohl (block->purpose.size) - sizeof (struct GNUNET_TIME_AbsoluteNBO);
- rid = get_op_id (h);
- qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry);
- qe->nsh = h;
- qe->cont = cont;
- qe->cont_cls = cont_cls;
- qe->op_id = rid;
- GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
-
- /* setup msg */
- msg_size = sizeof (struct BlockCacheMessage) + blen;
- pe = GNUNET_malloc (sizeof (struct PendingMessage) + msg_size);
- pe->size = msg_size;
- msg = (struct BlockCacheMessage *) &pe[1];
- msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE);
- msg->gns_header.header.size = htons (msg_size);
- msg->gns_header.r_id = htonl (rid);
- msg->expire = block->expiration_time;
- msg->signature = block->signature;
- msg->derived_key = block->derived_key;
- memcpy (&msg[1], &block[1], blen);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Sending `%s' message with size %u\n",
- "NAMESTORE_BLOCK_CACHE",
- (unsigned int) msg_size);
- GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
- do_transmit(h);
- return qe;
+ struct GNUNET_NAMESTORE_QueueEntry *qe = cls;
+
+ qe->timeout_task = NULL;
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Did not receive response from namestore after %s!\n",
+ GNUNET_STRINGS_relative_time_to_string (NAMESTORE_DELAY_TOLERANCE,
+ GNUNET_YES));
+ if (NULL != qe->cont)
+ {
+ qe->cont (qe->cont_cls,
+ GNUNET_SYSERR,
+ "timeout");
+ qe->cont = NULL;
+ }
+ GNUNET_NAMESTORE_cancel (qe);