[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20796 - in gnunet/src/gns: . testdb
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20796 - in gnunet/src/gns: . testdb |
Date: |
Wed, 28 Mar 2012 12:03:22 +0200 |
Author: schanzen
Date: 2012-03-28 12:03:22 +0200 (Wed, 28 Mar 2012)
New Revision: 20796
Modified:
gnunet/src/gns/gns.conf.in
gnunet/src/gns/gnunet-service-gns.c
gnunet/src/gns/gnunet-service-gns_resolver.c
gnunet/src/gns/gnunet-service-gns_resolver.h
gnunet/src/gns/testdb/sqlite-alice.db
gnunet/src/gns/testdb/sqlite-bob.db
gnunet/src/gns/testdb/sqlite-dave.db
Log:
-fix, add config
Modified: gnunet/src/gns/gns.conf.in
===================================================================
--- gnunet/src/gns/gns.conf.in 2012-03-28 09:36:05 UTC (rev 20795)
+++ gnunet/src/gns/gns.conf.in 2012-03-28 10:03:22 UTC (rev 20796)
@@ -8,6 +8,7 @@
ZONEKEY = $SERVICEHOME/gns/zonekey.zkey
HIJACK_DNS = YES
AUTO_IMPORT_PKEY = YES
+AUTO_IMPORT_CONFIRMATION_REQ = NO
MAX_PARALLEL_BACKGROUND_QUERIES = 25
DEFAULT_LOOKUP_TIMEOUT = 10
Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-03-28 09:36:05 UTC (rev 20795)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-03-28 10:03:22 UTC (rev 20796)
@@ -763,6 +763,7 @@
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
unsigned long long max_parallel_bg_queries = 0;
unsigned long long default_lookup_timeout_secs = 0;
+ int ignore_pending = GNUNET_NO;
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
{&handle_shorten, NULL, GNUNET_MESSAGE_TYPE_GNS_SHORTEN, 0},
@@ -804,16 +805,8 @@
return;
}
- /**
- * handle to the dht
- */
- dht_handle = GNUNET_DHT_connect(c, 1); //FIXME get ht_len from cfg
+
- if (NULL == dht_handle)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
- }
-
auto_import_pkey = GNUNET_NO;
if (GNUNET_YES ==
@@ -827,7 +820,7 @@
}
if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number(c, "gns",
+ GNUNET_CONFIGURATION_get_value_number (c, "gns",
"MAX_PARALLEL_BACKGROUND_QUERIES",
&max_parallel_bg_queries))
{
@@ -836,6 +829,15 @@
max_parallel_bg_queries);
}
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (c, "gns",
+ "AUTO_IMPORT_CONFIRMATION_REQ"))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ "Auto import requires user confirmation\n");
+ ignore_pending = GNUNET_YES;
+ }
+
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_number(c, "gns",
"DEFAULT_LOOKUP_TIMEOUT",
@@ -848,8 +850,20 @@
default_lookup_timeout_secs);
}
+ /**
+ * handle to the dht
+ */
+ dht_handle = GNUNET_DHT_connect(c,
+ max_parallel_bg_queries); //FIXME get ht_len from cfg
+
+ if (NULL == dht_handle)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
+ }
+
if (gns_resolver_init(namestore_handle, dht_handle, zone_hash,
- max_parallel_bg_queries)
+ max_parallel_bg_queries,
+ ignore_pending)
== GNUNET_SYSERR)
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c 2012-03-28 09:36:05 UTC
(rev 20795)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c 2012-03-28 10:03:22 UTC
(rev 20796)
@@ -65,6 +65,11 @@
static unsigned long long max_allowed_background_queries;
/**
+ * Wheather or not to ignore pending records
+ */
+static int ignore_pending_records;
+
+/**
* Our local zone
*/
static struct GNUNET_CRYPTO_ShortHashCode local_zone;
@@ -118,7 +123,7 @@
GNUNET_NAMESTORE_lookup_record(namestore_handle,
&gph->zone,
gph->new_name,
- GNUNET_GNS_RECORD_PSEU,
+ GNUNET_NAMESTORE_TYPE_ANY,
&process_pseu_lookup_ns,
gph);
return;
@@ -439,13 +444,16 @@
* @param dh the dht handle
* @param lz the local zone's hash
* @param max_bg_queries maximum number of parallel background queries in dht
+ * @param ignore_pending ignore records that still require user confirmation
+ * on lookup
* @return GNUNET_OK on success
*/
int
gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
struct GNUNET_DHT_Handle *dh,
struct GNUNET_CRYPTO_ShortHashCode lz,
- unsigned long long max_bg_queries)
+ unsigned long long max_bg_queries,
+ int ignore_pending)
{
namestore_handle = nh;
dht_handle = dh;
@@ -453,6 +461,7 @@
dht_lookup_heap =
GNUNET_CONTAINER_heap_create(GNUNET_CONTAINER_HEAP_ORDER_MIN);
max_allowed_background_queries = max_bg_queries;
+ ignore_pending_records = ignore_pending;
if ((namestore_handle != NULL) && (dht_handle != NULL))
{
@@ -944,6 +953,15 @@
if (rd[i].record_type != rlh->record_type)
continue;
+
+ if (ignore_pending_records &&
+ (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_REC-%d: Record %s is awaiting user confirmation.
Skipping\n",
+ rh->id, name);
+ continue;
+ }
if ((GNUNET_TIME_absolute_get_remaining (rd[i].expiration)).rel_value
== 0)
@@ -1913,7 +1931,8 @@
if (rd[i].record_type != GNUNET_GNS_RECORD_PKEY)
continue;
- if (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING)
+ if (ignore_pending_records &&
+ (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING))
{
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_PHASE_DELEGATE_NS-%llu: PKEY for %s is pending user
confirmation.\n",
Modified: gnunet/src/gns/gnunet-service-gns_resolver.h
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.h 2012-03-28 09:36:05 UTC
(rev 20795)
+++ gnunet/src/gns/gnunet-service-gns_resolver.h 2012-03-28 10:03:22 UTC
(rev 20796)
@@ -255,13 +255,16 @@
* @param dh handle to the dht
* @param lz the local zone
* @param max_bg_queries maximum amount of background queries
+ * @param ignore_pending ignore records that still require user confirmation
+ * on lookup
* @returns GNUNET_OK on success
*/
int
gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
struct GNUNET_DHT_Handle *dh,
struct GNUNET_CRYPTO_ShortHashCode lz,
- unsigned long long max_bg_queries);
+ unsigned long long max_bg_queries,
+ int ignore_pending);
/**
* Cleanup resolver: Terminate pending lookups
Modified: gnunet/src/gns/testdb/sqlite-alice.db
===================================================================
(Binary files differ)
Modified: gnunet/src/gns/testdb/sqlite-bob.db
===================================================================
(Binary files differ)
Modified: gnunet/src/gns/testdb/sqlite-dave.db
===================================================================
(Binary files differ)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20796 - in gnunet/src/gns: . testdb,
gnunet <=