aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/gnunet-service-peerstore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerstore/gnunet-service-peerstore.c')
-rw-r--r--src/peerstore/gnunet-service-peerstore.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c
index bdd93e63a..3f54eed85 100644
--- a/src/peerstore/gnunet-service-peerstore.c
+++ b/src/peerstore/gnunet-service-peerstore.c
@@ -137,7 +137,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
137 137
138 138
139/* Forward declaration */ 139/* Forward declaration */
140static void expire_records_continuation (void *cls, int success); 140static void
141expire_records_continuation (void *cls, int success);
141 142
142 143
143/** 144/**
@@ -152,8 +153,9 @@ cleanup_expired_records (void *cls,
152 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 153 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
153 return; 154 return;
154 GNUNET_assert (NULL != db); 155 GNUNET_assert (NULL != db);
155 ret = db->expire_records (db->cls, GNUNET_TIME_absolute_get (), 156 ret =
156 expire_records_continuation, NULL); 157 db->expire_records (db->cls, GNUNET_TIME_absolute_get (),
158 expire_records_continuation, NULL);
157 if (GNUNET_OK != ret) 159 if (GNUNET_OK != ret)
158 { 160 {
159 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 161 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -171,7 +173,7 @@ cleanup_expired_records (void *cls,
171 * @param success count of records deleted or #GNUNET_SYSERR 173 * @param success count of records deleted or #GNUNET_SYSERR
172 */ 174 */
173static void 175static void
174expire_records_continuation(void *cls, int success) 176expire_records_continuation (void *cls, int success)
175{ 177{
176 if (success > 0) 178 if (success > 0)
177 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%d records expired.\n", success); 179 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%d records expired.\n", success);
@@ -239,8 +241,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
239 * @return #GNUNET_YES to continue iteration 241 * @return #GNUNET_YES to continue iteration
240 */ 242 */
241static int 243static int
242record_iterator (void *cls, 244record_iterator (void *cls, const struct GNUNET_PEERSTORE_Record *record,
243 const struct GNUNET_PEERSTORE_Record *record,
244 const char *emsg) 245 const char *emsg)
245{ 246{
246 struct GNUNET_PEERSTORE_Record *cls_record = cls; 247 struct GNUNET_PEERSTORE_Record *cls_record = cls;
@@ -252,6 +253,7 @@ record_iterator (void *cls,
252 struct GNUNET_MessageHeader *endmsg; 253 struct GNUNET_MessageHeader *endmsg;
253 254
254 endmsg = GNUNET_new (struct GNUNET_MessageHeader); 255 endmsg = GNUNET_new (struct GNUNET_MessageHeader);
256
255 endmsg->size = htons (sizeof (struct GNUNET_MessageHeader)); 257 endmsg->size = htons (sizeof (struct GNUNET_MessageHeader));
256 endmsg->type = htons (GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END); 258 endmsg->type = htons (GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END);
257 GNUNET_SERVER_notification_context_unicast (nc, cls_record->client, endmsg, 259 GNUNET_SERVER_notification_context_unicast (nc, cls_record->client, endmsg,
@@ -463,20 +465,17 @@ handle_store (void *cls, struct GNUNET_SERVER_Client *client,
463 return; 465 return;
464 } 466 }
465 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 467 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
466 "Received a store request (size: %lu).\n" 468 "Received a store request (size: %lu).\n" " Sub system `%s'\n"
467 " Sub system `%s'\n" 469 " Peer `%s'\n" " Key `%s'\n" " Value size %lu\n"
468 " Peer `%s'\n" 470 " Options: %d.\n", record->value_size, record->sub_system,
469 " Key `%s'\n" 471 GNUNET_i2s (record->peer), record->key, record->value_size,
470 " Value size %lu\n" 472 ntohl (srm->options));
471 " Options: %d.\n",
472 record->value_size, record->sub_system, GNUNET_i2s (record->peer),
473 record->key, record->value_size, ntohl (srm->options));
474 record->client = client; 473 record->client = client;
475 if (GNUNET_OK != 474 if (GNUNET_OK !=
476 db->store_record (db->cls, record->sub_system, record->peer, record->key, 475 db->store_record (db->cls, record->sub_system, record->peer, record->key,
477 record->value, record->value_size, *record->expiry, 476 record->value, record->value_size, *record->expiry,
478 ntohl (srm->options), store_record_continuation, 477 ntohl (srm->options), store_record_continuation,
479 record)) 478 record))
480 { 479 {
481 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 480 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
482 _("Failed to store requested value, database error.")); 481 _("Failed to store requested value, database error."));