/**
* Our configuration.
*/
-struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
"Deleting content that expired %llu ms ago\n",
(unsigned long long) (now.value - expiration.value));
#endif
+ GNUNET_CONTAINER_bloomfilter_remove (filter,
+ key);
return GNUNET_NO; /* delete */
}
size + GNUNET_DATASTORE_ENTRY_OVERHEAD,
*need);
#endif
+ GNUNET_CONTAINER_bloomfilter_remove (filter,
+ key);
return GNUNET_NO;
}
*
* @param client target of the message
* @param msg message to transmit, will be freed!
+ * @param tc function to call afterwards
+ * @param tc_cls closure for tc
* @param end is this the last response (and we should
* signal the server completion accodingly after
* transmitting this message)?
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting `%s' message with value %d and message %s\n",
+ "Transmitting `%s' message with value %d and message `%s'\n",
"STATUS",
code,
msg != NULL ? msg : "(none)");
sm->header.size = htons(sizeof(struct StatusMessage) + slen);
sm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_STATUS);
sm->status = htonl(code);
- memcpy (&sm[1], msg, slen);
+ if (slen > 0)
+ memcpy (&sm[1], msg, slen);
transmit (client, &sm->header, NULL, NULL, GNUNET_YES);
}
* Function called once the transmit operation has
* either failed or succeeded.
*
- * @param cls closure
+ * @param next_cls closure for calling "next_request" callback
* @param status GNUNET_OK on success, GNUNET_SYSERR on error
*/
static void
unsigned long long used;
unsigned long long req;
uint64_t amount;
- uint64_t entries;
+ uint32_t entries;
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing `%s' request\n",
"RESERVE");
#endif
- amount = ntohl(msg->amount);
- entries = GNUNET_ntohll(msg->entries);
+ amount = GNUNET_ntohll(msg->amount);
+ entries = ntohl(msg->entries);
used = plugin->api->get_size (plugin->api->cls) + reserved;
req = amount + ((unsigned long long) GNUNET_DATASTORE_ENTRY_OVERHEAD) * entries;
if (used + req > quota)
return;
}
prev = pos;
- pos = next;
}
GNUNET_break (0);
transmit_status (client, GNUNET_SYSERR, gettext_noop ("Could not find matching reservation"));
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- static struct GNUNET_TIME_Absolute zero;
const struct GetMessage *msg;
uint16_t size;
"Empty result set for `%s' request.\n",
"GET");
#endif
+ GNUNET_SERVER_client_keep (client);
transmit_item (client,
- NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+ NULL, NULL, 0, NULL, 0, 0, 0,
+ GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
GNUNET_SERVER_client_keep (client);
if (GNUNET_YES == rc->found)
transmit_status (rc->client, GNUNET_OK, NULL);
else
- transmit_status (rc->client, GNUNET_SYSERR, _("Content not found"));
+ transmit_status (rc->client, GNUNET_NO, _("Content not found"));
GNUNET_SERVER_client_drop (rc->client);
GNUNET_free (rc);
return GNUNET_OK; /* last item */
GNUNET_CRYPTO_hash (&dm[1],
ntohl(dm->size),
&vhash);
- GNUNET_SERVER_client_keep (client);
plugin->api->get (plugin->api->cls,
&dm->key,
&vhash,
{
unload_plugin (plugin);
plugin = NULL;
+ if (filter != NULL)
+ {
+ GNUNET_CONTAINER_bloomfilter_free (filter);
+ filter = NULL;
+ }
}
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
char *fn;
unsigned int bf_size;
if (NULL == plugin)
{
GNUNET_CONTAINER_bloomfilter_free (filter);
+ filter = NULL;
return;
}
GNUNET_SERVER_disconnect_notify (server, &cleanup_reservations, NULL);