X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fpeerstore%2Fgnunet-service-peerstore.c;h=3414111f610a23ca9bc8e78172d2abb43489bd2c;hb=09b6a814e0ddcca0497c5cbf37940c27e6a5d9de;hp=665e625fd6032f9e90f873003acd3bbaa424c708;hpb=b5af62e0dff6b748db0c4da373b926451b45055f;p=oweals%2Fgnunet.git diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c index 665e625fd..3414111f6 100644 --- a/src/peerstore/gnunet-service-peerstore.c +++ b/src/peerstore/gnunet-service-peerstore.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2014, 2015, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ /** @@ -260,15 +258,23 @@ record_iterator (void *cls, GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (cls_record->client), env); if (NULL == emsg) + { GNUNET_SERVICE_client_continue (cls_record->client); + } else + { + GNUNET_break (0); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to iterate: %s\n", + emsg); GNUNET_SERVICE_client_drop (cls_record->client); + } PEERSTORE_destroy_record (cls_record); return; } env = PEERSTORE_create_record_mq_envelope (record->sub_system, - record->peer, + &record->peer, record->key, record->value, record->value_size, @@ -301,7 +307,7 @@ watch_notifier_it (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found a watcher to update.\n"); env = PEERSTORE_create_record_mq_envelope (record->sub_system, - record->peer, + &record->peer, record->key, record->value, record->value_size, @@ -325,7 +331,7 @@ watch_notifier (struct GNUNET_PEERSTORE_Record *record) struct GNUNET_HashCode keyhash; PEERSTORE_hash_key (record->sub_system, - record->peer, + &record->peer, record->key, &keyhash); GNUNET_CONTAINER_multihashmap_get_multiple (watchers, @@ -434,17 +440,18 @@ handle_iterate (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Iterate request: ss `%s', peer `%s', key `%s'\n", record->sub_system, - (NULL == record->peer) ? "NULL" : GNUNET_i2s (record->peer), + GNUNET_i2s (&record->peer), (NULL == record->key) ? "NULL" : record->key); record->client = client; if (GNUNET_OK != db->iterate_records (db->cls, record->sub_system, - record->peer, + (ntohs (srm->peer_set)) ? &record->peer : NULL, record->key, &record_iterator, record)) { + GNUNET_break (0); GNUNET_SERVICE_client_drop (client); PEERSTORE_destroy_record (record); } @@ -470,6 +477,7 @@ store_record_continuation (void *cls, } else { + GNUNET_break (0); GNUNET_SERVICE_client_drop (record->client); } PEERSTORE_destroy_record (record); @@ -496,7 +504,6 @@ check_store (void *cls, return GNUNET_SYSERR; } if ( (NULL == record->sub_system) || - (NULL == record->peer) || (NULL == record->key) ) { GNUNET_break (0); @@ -523,24 +530,25 @@ handle_store (void *cls, record = PEERSTORE_parse_record_message (srm); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Received a store request. Sub system `%s' Peer `%s Key `%s' Options: %d.\n", + "Received a store request. Sub system `%s' Peer `%s Key `%s' Options: %u.\n", record->sub_system, - GNUNET_i2s (record->peer), + GNUNET_i2s (&record->peer), record->key, - ntohl (srm->options)); + (uint32_t) ntohl (srm->options)); record->client = client; if (GNUNET_OK != db->store_record (db->cls, record->sub_system, - record->peer, + &record->peer, record->key, record->value, record->value_size, - *record->expiry, + record->expiry, ntohl (srm->options), &store_record_continuation, record)) { + GNUNET_break (0); PEERSTORE_destroy_record (record); GNUNET_SERVICE_client_drop (client); return;