aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-service-namestore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r--src/namestore/gnunet-service-namestore.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index b1f8fcf4c..45be0fe75 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -124,7 +124,7 @@ struct ZoneIteration
124 * message and free the data structure once @e cache_ops is zero. 124 * message and free the data structure once @e cache_ops is zero.
125 */ 125 */
126 int send_end; 126 int send_end;
127 127
128}; 128};
129 129
130 130
@@ -268,7 +268,7 @@ struct CacheOperation
268 * for if applicable, can be NULL. 268 * for if applicable, can be NULL.
269 */ 269 */
270 struct ZoneIteration *zi; 270 struct ZoneIteration *zi;
271 271
272 /** 272 /**
273 * Client's request ID. 273 * Client's request ID.
274 */ 274 */
@@ -318,12 +318,12 @@ struct StoreActivity
318 318
319/** 319/**
320 * Entry in list of cached nick resolutions. 320 * Entry in list of cached nick resolutions.
321 */ 321 */
322struct NickCache 322struct NickCache
323{ 323{
324 /** 324 /**
325 * Zone the cache entry is for. 325 * Zone the cache entry is for.
326 */ 326 */
327 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 327 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
328 328
329 /** 329 /**
@@ -339,7 +339,7 @@ struct NickCache
339 339
340 340
341/** 341/**
342 * We cache nick records to reduce DB load. 342 * We cache nick records to reduce DB load.
343 */ 343 */
344static struct NickCache nick_cache[NC_SIZE]; 344static struct NickCache nick_cache[NC_SIZE];
345 345
@@ -489,7 +489,7 @@ free_store_activity (struct StoreActivity *sa)
489 * record, which (if found) is then copied to @a cls for future use. 489 * record, which (if found) is then copied to @a cls for future use.
490 * 490 *
491 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found) 491 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found)
492 * @param seq sequence number of the record 492 * @param seq sequence number of the record, MUST NOT BE ZERO
493 * @param private_key the private key of the zone (unused) 493 * @param private_key the private key of the zone (unused)
494 * @param label should be #GNUNET_GNS_EMPTY_LABEL_AT 494 * @param label should be #GNUNET_GNS_EMPTY_LABEL_AT
495 * @param rd_count number of records in @a rd 495 * @param rd_count number of records in @a rd
@@ -506,7 +506,7 @@ lookup_nick_it (void *cls,
506 struct GNUNET_GNSRECORD_Data **res = cls; 506 struct GNUNET_GNSRECORD_Data **res = cls;
507 507
508 (void) private_key; 508 (void) private_key;
509 (void) seq; 509 GNUNET_assert (0 != seq);
510 if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT)) 510 if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT))
511 { 511 {
512 GNUNET_break (0); 512 GNUNET_break (0);
@@ -607,7 +607,7 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
607 return nick; 607 return nick;
608 } 608 }
609 } 609 }
610 610
611 nick = NULL; 611 nick = NULL;
612 res = GSN_database->lookup_records (GSN_database->cls, 612 res = GSN_database->lookup_records (GSN_database->cls,
613 zone, 613 zone,
@@ -872,7 +872,7 @@ zone_iteration_done_client_continue (struct ZoneIteration *zi)
872 em->r_id = htonl (zi->request_id); 872 em->r_id = htonl (zi->request_id);
873 GNUNET_MQ_send (zi->nc->mq, 873 GNUNET_MQ_send (zi->nc->mq,
874 env); 874 env);
875 875
876 GNUNET_CONTAINER_DLL_remove (zi->nc->op_head, 876 GNUNET_CONTAINER_DLL_remove (zi->nc->op_head,
877 zi->nc->op_tail, 877 zi->nc->op_tail,
878 zi); 878 zi);
@@ -1270,9 +1270,16 @@ struct RecordLookupContext
1270 1270
1271 1271
1272/** 1272/**
1273 * FIXME. 1273 * Function called by the namestore plugin when we are trying to lookup
1274 * a record as part of #handle_record_lookup(). Merges all results into
1275 * the context.
1274 * 1276 *
1275 * @param seq sequence number of the record 1277 * @param cls closure with a `struct RecordLookupContext`
1278 * @param seq unique serial number of the record, MUST NOT BE ZERO
1279 * @param zone_key private key of the zone
1280 * @param label name that is being mapped (at most 255 characters long)
1281 * @param rd_count number of entries in @a rd array
1282 * @param rd array of records with data to store
1276 */ 1283 */
1277static void 1284static void
1278lookup_it (void *cls, 1285lookup_it (void *cls,
@@ -1285,7 +1292,7 @@ lookup_it (void *cls,
1285 struct RecordLookupContext *rlc = cls; 1292 struct RecordLookupContext *rlc = cls;
1286 1293
1287 (void) private_key; 1294 (void) private_key;
1288 (void) seq; 1295 GNUNET_assert (0 != seq);
1289 if (0 != strcmp (label, 1296 if (0 != strcmp (label,
1290 rlc->label)) 1297 rlc->label))
1291 return; 1298 return;
@@ -1609,7 +1616,7 @@ handle_record_store (void *cls,
1609 conv_name)) || 1616 conv_name)) ||
1610 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) ) 1617 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) )
1611 rd_clean_off++; 1618 rd_clean_off++;
1612 1619
1613 if ( (0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, 1620 if ( (0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT,
1614 conv_name)) && 1621 conv_name)) &&
1615 (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) ) 1622 (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) )
@@ -1680,7 +1687,7 @@ struct ZoneToNameCtx
1680 * Zone to name iterator 1687 * Zone to name iterator
1681 * 1688 *
1682 * @param cls struct ZoneToNameCtx * 1689 * @param cls struct ZoneToNameCtx *
1683 * @param seq sequence number of the record 1690 * @param seq sequence number of the record, MUST NOT BE ZERO
1684 * @param zone_key the zone key 1691 * @param zone_key the zone key
1685 * @param name name 1692 * @param name name
1686 * @param rd_count number of records in @a rd 1693 * @param rd_count number of records in @a rd
@@ -1704,7 +1711,7 @@ handle_zone_to_name_it (void *cls,
1704 char *name_tmp; 1711 char *name_tmp;
1705 char *rd_tmp; 1712 char *rd_tmp;
1706 1713
1707 (void) seq; 1714 GNUNET_assert (0 != seq);
1708 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1715 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1709 "Found result for zone-to-name lookup: `%s'\n", 1716 "Found result for zone-to-name lookup: `%s'\n",
1710 name); 1717 name);
@@ -1822,7 +1829,7 @@ struct ZoneIterationProcResult
1822 * Process results for zone iteration from database 1829 * Process results for zone iteration from database
1823 * 1830 *
1824 * @param cls struct ZoneIterationProcResult 1831 * @param cls struct ZoneIterationProcResult
1825 * @param seq sequence number of the record 1832 * @param seq sequence number of the record, MUST NOT BE ZERO
1826 * @param zone_key the zone key 1833 * @param zone_key the zone key
1827 * @param name name 1834 * @param name name
1828 * @param rd_count number of records for this name 1835 * @param rd_count number of records for this name
@@ -1839,6 +1846,7 @@ zone_iterate_proc (void *cls,
1839 struct ZoneIterationProcResult *proc = cls; 1846 struct ZoneIterationProcResult *proc = cls;
1840 int do_refresh_block; 1847 int do_refresh_block;
1841 1848
1849 GNUNET_assert (0 != seq);
1842 if ( (NULL == zone_key) && 1850 if ( (NULL == zone_key) &&
1843 (NULL == name) ) 1851 (NULL == name) )
1844 { 1852 {
@@ -1876,7 +1884,7 @@ zone_iterate_proc (void *cls,
1876 do_refresh_block = GNUNET_YES; 1884 do_refresh_block = GNUNET_YES;
1877 break; 1885 break;
1878 } 1886 }
1879 if (GNUNET_YES == do_refresh_block) 1887 if (GNUNET_YES == do_refresh_block)
1880 refresh_block (NULL, 1888 refresh_block (NULL,
1881 proc->zi, 1889 proc->zi,
1882 0, 1890 0,
@@ -2116,7 +2124,7 @@ monitor_iteration_next (void *cls);
2116 * A #GNUNET_NAMESTORE_RecordIterator for monitors. 2124 * A #GNUNET_NAMESTORE_RecordIterator for monitors.
2117 * 2125 *
2118 * @param cls a 'struct ZoneMonitor *' with information about the monitor 2126 * @param cls a 'struct ZoneMonitor *' with information about the monitor
2119 * @param seq sequence number of the record 2127 * @param seq sequence number of the record, MUST NOT BE ZERO
2120 * @param zone_key zone key of the zone 2128 * @param zone_key zone key of the zone
2121 * @param name name 2129 * @param name name
2122 * @param rd_count number of records in @a rd 2130 * @param rd_count number of records in @a rd
@@ -2132,6 +2140,7 @@ monitor_iterate_cb (void *cls,
2132{ 2140{
2133 struct ZoneMonitor *zm = cls; 2141 struct ZoneMonitor *zm = cls;
2134 2142
2143 GNUNET_assert (0 != seq);
2135 zm->seq = seq; 2144 zm->seq = seq;
2136 GNUNET_assert (NULL != name); 2145 GNUNET_assert (NULL != name);
2137 GNUNET_STATISTICS_update (statistics, 2146 GNUNET_STATISTICS_update (statistics,