gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r2431 - GNUnet GNUnet/doc/man GNUnet/src/applications/dht/m


From: grothoff
Subject: [GNUnet-SVN] r2431 - GNUnet GNUnet/doc/man GNUnet/src/applications/dht/module GNUnet/src/applications/dht/tools GNUnet/src/applications/fs/tools gnunet-gtk
Date: Sun, 1 Jan 2006 02:21:13 -0800 (PST)

Author: grothoff
Date: 2006-01-01 02:21:05 -0800 (Sun, 01 Jan 2006)
New Revision: 2431

Removed:
   GNUnet/src/applications/dht/module/dht_test.c
Modified:
   GNUnet/ChangeLog
   GNUnet/doc/man/gnunet-pseudonym.1
   GNUnet/src/applications/dht/module/cs.c
   GNUnet/src/applications/dht/module/dht.c
   GNUnet/src/applications/dht/tools/Makefile.am
   GNUnet/src/applications/dht/tools/dhttest2.c
   GNUnet/src/applications/dht/tools/peer1.conf
   GNUnet/src/applications/dht/tools/peer2.conf
   GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
   GNUnet/todo
   gnunet-gtk/TODO
Log:
sync

Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog    2006-01-01 08:39:24 UTC (rev 2430)
+++ GNUnet/ChangeLog    2006-01-01 10:21:05 UTC (rev 2431)
@@ -1,3 +1,6 @@
+Sat Dec 31 17:02:37 PST 2005
+       Added support for using -k multiple times in gnunet-pseudonym.
+
 Wen Dec 28 00:22:54 CET 2005
        Fixed deadlock in http transport.
 

Modified: GNUnet/doc/man/gnunet-pseudonym.1
===================================================================
--- GNUnet/doc/man/gnunet-pseudonym.1   2006-01-01 08:39:24 UTC (rev 2430)
+++ GNUnet/doc/man/gnunet-pseudonym.1   2006-01-01 10:21:05 UTC (rev 2431)
@@ -14,7 +14,7 @@
 
 Creating a new pseudonym requires using the \-C option together with a 
nickname that is to be used for the namespace.  Nicknames must be unique for 
each user, global uniqueness is desireable but not necessary.  If two 
namespaces in GNUnet use the same nickname all GNUnet tools will display the 
nickname together with the unique namespace identifier (which is derived from 
the public key and hence guaranteed to be unique) to avoid ambiguity.  
Additional options can be passed together with the \-C option to provide 
additional meta-data that describes the namespace.  Possible meta-data includes 
the 'realname' of the person controlling the namespace, a description, the 
mime-type for content in the namespace (useful if the namespace is dedicated to 
some specific type of content) and contact information.  One important piece of 
meta-data that can be specified is the identifier of a document root, that is 
the name of a file in the namespace that is a portal to the rest of the 
content.  This is useful to help users find this root in the absence of 
conventions.  Note that all of this meta-data is optional and should never be 
trusted blindly.
 
-gnunet\-pseudonym also lists the meta-data available for other namespaces.  
Namespaces can be discovered whenever the peer obtains the namespace 
advertisement that is created at the time where the pseudonym is created.  
Namespace advertisements can be found in directories (not implemented), 
ordinary keyword-based searches (by default gnunet\-pseudonym publishes the 
namespace advertisement under the keyword 'namespace', but the \-k option can 
be used to specify another keyword) and under the 'all-zeros' identifier of the 
respective namespace (using a namespace-search if the namespace ID is already 
known).
+gnunet\-pseudonym also lists the meta-data available for other namespaces.  
Namespaces can be discovered whenever the peer obtains the namespace 
advertisement that is created at the time where the pseudonym is created.  
Namespace advertisements can be found in directories (not implemented), 
ordinary keyword-based searches (by default gnunet\-pseudonym publishes the 
namespace advertisement under the keyword 'namespace', but the \-k option can 
be used to specify other keywords) and under the 'all-zeros' identifier of the 
respective namespace (using a namespace-search if the namespace ID is already 
known).
 
 For more details about GNUnet namespaces and content encoding please read the 
'Encoding for Censorship-resistant Sharing' (ECRS) paper which can be found on 
the GNUnet webpage.
 
@@ -43,7 +43,7 @@
 print help page
 .TP
 \fB\-k KEYWORD\fR, \fB\-\-keyword=KEYWORD\fR
-Publish the namespace advertisement under the keyword 'KEYWORD'.  Default is 
'namespace' (use with \-C).
+Publish the namespace advertisement under the keyword 'KEYWORD'.  Default is 
'namespace' (use with \-C).  You can specify \-k multiple times.  In that case, 
the namespace will be published under each of those keywords.
 .TP
 \fB\-m MIMETYPE\fR, \fB\-\-mimetype=MIMETYPE\fR
 Advertise that the namespace contains files of the given MIMETYPE (use with 
\-C).

Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c     2006-01-01 08:39:24 UTC (rev 
2430)
+++ GNUnet/src/applications/dht/module/cs.c     2006-01-01 10:21:05 UTC (rev 
2431)
@@ -171,8 +171,10 @@
   DHT_CLIENT_TableHandlers * handlers = closure;
   int ret;
 
-  if (keyCount < 1)
+  if (keyCount < 1) {
+    BREAK();
     return SYSERR;
+  }
 
   SEMAPHORE_DOWN(handlers->prerequest);
   handlers->resultCallback = resultCallback;
@@ -357,8 +359,10 @@
   CS_dht_request_join_MESSAGE * req;
   int ret;
 
-  if (ntohs(message->size) != sizeof(CS_dht_request_join_MESSAGE))
+  if (ntohs(message->size) != sizeof(CS_dht_request_join_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
   req = (CS_dht_request_join_MESSAGE*) message;
   MUTEX_LOCK(&csLock);
   ptr = MALLOC(sizeof(DHT_CLIENT_TableHandlers));
@@ -404,8 +408,10 @@
   int i;
   DHT_CLIENT_TableHandlers * ptr;
 
-  if (ntohs(message->size) != sizeof(CS_dht_request_leave_MESSAGE))
+  if (ntohs(message->size) != sizeof(CS_dht_request_leave_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
   req = (CS_dht_request_leave_MESSAGE*) message;
   LOG(LOG_EVERYTHING,
       "Client leaving request received!\n");
@@ -444,9 +450,13 @@
                 SYSERR);
 }
 
-static void cs_put_abort(DHT_CLIENT_PUT_RECORD * record) {
+static void cs_put_abort(void * cls) {
+  DHT_CLIENT_PUT_RECORD * record = cls;
   int i;
 
+  LOG(LOG_DEBUG,
+      "Signaling client put completion: %d\n",
+      record->replicas);
   MUTEX_LOCK(&csLock);
   dhtAPI->put_stop(record->put_record);
   if (OK != sendAck(record->client,
@@ -479,8 +489,10 @@
   DHT_CLIENT_PUT_RECORD * ptr;
   unsigned int size;
 
-  if (ntohs(message->size) < sizeof(CS_dht_request_put_MESSAGE))
+  if (ntohs(message->size) < sizeof(CS_dht_request_put_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
   req = (CS_dht_request_put_MESSAGE*) message;
   size = ntohs(req->header.size)
     - sizeof(CS_dht_request_put_MESSAGE)
@@ -507,11 +519,13 @@
        putRecordsSize+1);
   putRecords[putRecordsSize-1] = ptr;
   MUTEX_UNLOCK(&csLock);
+  LOG(LOG_DEBUG,
+      "Starting DHT put\n");
   ptr->put_record = dhtAPI->put_start(&req->table,
                                      &req->key,
                                      ntohll(req->timeout),
                                      data,
-                                     (DHT_OP_Complete) &cs_put_abort,
+                                     &cs_put_abort,
                                      ptr);
   FREE(data);
   return OK;
@@ -601,8 +615,10 @@
                    const CS_MESSAGE_HEADER * message) {
   struct CSRemoveClosure * cpc;
 
-  if (ntohs(message->size) < sizeof(CS_dht_request_remove_MESSAGE))
+  if (ntohs(message->size) < sizeof(CS_dht_request_remove_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
   cpc = MALLOC(sizeof(struct CSRemoveClosure));
   cpc->message = MALLOC(ntohs(message->size));
   memcpy(cpc->message,
@@ -620,7 +636,8 @@
 
 static int cs_get_result_callback(const HashCode512 * key,
                                  const DataContainer * value,
-                                 DHT_CLIENT_GET_RECORD * record) {
+                                 void * cls) {
+  DHT_CLIENT_GET_RECORD * record = cls;
   CS_dht_reply_results_MESSAGE * msg;
   size_t n;
 
@@ -649,7 +666,8 @@
   return OK;
 }
                                
-static void cs_get_abort(DHT_CLIENT_GET_RECORD * record) {
+static void cs_get_abort(void * cls) {
+  DHT_CLIENT_GET_RECORD * record = cls;
   int i;
 
   dhtAPI->get_stop(record->get_record);
@@ -721,9 +739,9 @@
                                      keyCount,
                                      &req->keys,
                                      ntohll(req->timeout),
-                                     (DataProcessor) &cs_get_result_callback,
+                                     &cs_get_result_callback,
                                      ptr,
-                                     (DHT_OP_Complete) &cs_get_abort,
+                                     &cs_get_abort,
                                      ptr);
   return OK;
 }
@@ -735,8 +753,10 @@
                 const CS_MESSAGE_HEADER * message) {
   struct CSGetClosure * cpc;
 
-  if (ntohs(message->size) != sizeof(CS_dht_request_get_MESSAGE))
+  if (ntohs(message->size) != sizeof(CS_dht_request_get_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
 
   cpc = MALLOC(sizeof(struct CSGetClosure));
   cpc->message = MALLOC(ntohs(message->size));
@@ -762,8 +782,10 @@
   CS_dht_reply_ack_MESSAGE * req;
   int i;
 
-  if (ntohs(message->size) != sizeof(CS_dht_reply_ack_MESSAGE))
+  if (ntohs(message->size) != sizeof(CS_dht_reply_ack_MESSAGE)) {
+    BREAK();
     return SYSERR;
+  }
   req =(CS_dht_reply_ack_MESSAGE*) message;
   LOG(LOG_EVERYTHING,
       "`%s' received from client.\n",
@@ -874,7 +896,7 @@
     if (getRecords[i]->client == client) {
       gr = getRecords[i];
 
-      delCronJob((CronJob) &cs_get_abort,
+      delCronJob(&cs_get_abort,
                 0,
                 gr);
       dhtAPI->get_stop(gr->get_record);
@@ -888,7 +910,7 @@
     if (putRecords[i]->client == client) {
       pr = putRecords[i];
 
-      delCronJob((CronJob) &cs_put_abort,
+      delCronJob(&cs_put_abort,
                 0,
                 pr);
       dhtAPI->put_stop(pr->put_record);
@@ -996,7 +1018,7 @@
     status = SYSERR;
 
   while (putRecordsSize > 0) {
-    delCronJob((CronJob) &cs_put_abort,
+    delCronJob(&cs_put_abort,
               0,
               putRecords[0]);
     cs_put_abort(putRecords[0]);
@@ -1010,7 +1032,7 @@
   }
 
   while (getRecordsSize > 0) {
-    delCronJob((CronJob) &cs_get_abort,
+    delCronJob(&cs_get_abort,
               0,
               getRecords[0]);
     cs_get_abort(getRecords[0]);

Modified: GNUnet/src/applications/dht/module/dht.c
===================================================================
--- GNUnet/src/applications/dht/module/dht.c    2006-01-01 08:39:24 UTC (rev 
2430)
+++ GNUnet/src/applications/dht/module/dht.c    2006-01-01 10:21:05 UTC (rev 
2431)
@@ -1,6 +1,6 @@
  /*
       This file is part of GNUnet
-      (C) 2004, 2005 Christian Grothoff (and other contributing authors)
+      (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -35,10 +35,14 @@
  *
  * Todo:
  * 1) document (lots!)
+ * 2) test & debug & complete code
+ * 3) look into threading issues (deadlock? data races?)
  *
  * Desirable features:
  * 1) security: how to pick priorities?  Access rights?
  * 2) performance: add optional hello messages
+ * 3) allow clients to modify data that is stored/retrieved
+ *    on-the-fly (i.e. to implement signed paths for locations!)
  */
 
 #include "platform.h"
@@ -610,7 +614,7 @@
  * This is just the prototype, the function is below.
  */
 static void request_DHT_ping(const PeerIdentity * identity,
-                            FindNodesContext * fnc);
+                            void * fnc);
 
 static FindKNodesContext * findKNodes_start(const DHT_TableId * table,
                                            const HashCode512 * key,
@@ -1225,9 +1229,11 @@
  * We received a reply from a peer that we ping'ed.  Update
  * the FNC's kbest list and the buckets accordingly.
  */
-static void ping_reply_handler(const PeerIdentity * responder,
-                              RPC_Param * results,
-                              FindNodesContext * fnc) {
+static void 
+ping_reply_handler(const PeerIdentity * responder,
+                  RPC_Param * results,
+                  void * cls) {
+  FindNodesContext * fnc = cls;
   int i;
   EncName enc;
   PeerInfo * pos;
@@ -1282,7 +1288,8 @@
  * information.  Note that this is done asynchronously.
  */
 static void request_DHT_ping(const PeerIdentity * identity,
-                            FindNodesContext * fnc) {
+                            void * cls) {
+  FindNodesContext * fnc = cls;
   RPC_Param * request_param;
   PeerInfo * pos;
   cron_t now;
@@ -1457,8 +1464,10 @@
  * processed by the callback in record.  The RPC async handle is to be
  * stored in the records rpc list.  Locking is not required.
  */
-static void send_dht_get_rpc(const PeerIdentity * peer,
-                            DHT_GET_RECORD * record) {
+static int
+send_dht_get_rpc(const PeerIdentity * peer,
+                void * cls) {
+  DHT_GET_RECORD * record = cls;
   RPC_Param * param;
   unsigned long long timeout;
   unsigned int type;
@@ -1479,7 +1488,7 @@
   if (isNotCloserThanMe(&record->table,
                        peer,           
                        record->keys))
-    return; /* refuse! */
+    return OK; /* refuse! */
   cronTime(&now);
   if (record->timeout > now)
     delta = (record->timeout - now) / 2;
@@ -1517,6 +1526,7 @@
                        (RPC_Complete) &dht_findvalue_rpc_reply_callback,
                        record);
   RPC_paramFree(param);
+  return OK;
 }
 
 /**
@@ -1713,7 +1723,7 @@
                         &keys[0],
                         timeout,
                         ALPHA,
-                        (NodeFoundCallback) &send_dht_get_rpc,
+                        &send_dht_get_rpc,
                         ret);
   }
   MUTEX_UNLOCK(lock);
@@ -1765,7 +1775,8 @@
 static int
 findnodes_dht_master_get_callback(const HashCode512 * key,
                                  const DataContainer * cont,
-                                 FindNodesContext * fnc) {
+                                 void * cls) {
+  FindNodesContext * fnc = cls;
   unsigned int dataLength;
   const PeerIdentity * id;
   int i;
@@ -1882,7 +1893,7 @@
      /* No or too few other DHT peers known, search
         for more by sending a PING to all connected peers
         that are not in the table already */
-      coreAPI->forAllConnectedNodes((PerNodeCallback)&request_DHT_ping,
+      coreAPI->forAllConnectedNodes(&request_DHT_ping,
                                    fnc);
     } else {
 #if DEBUG_DHT
@@ -1902,7 +1913,7 @@
                              1, /* 1 key */
                              table, /* key */
                              timeout,
-                             (DataProcessor) 
&findnodes_dht_master_get_callback,
+                             &findnodes_dht_master_get_callback,
                              fnc,
                              NULL,
                              NULL);
@@ -1957,9 +1968,11 @@
  *  looking for; pass those Helos to the core *and* to the callback
  *  as peers supporting the table.
  */
-static void find_k_nodes_dht_master_get_callback(const HashCode512 * key,
-                                                const DataContainer * cont,
-                                                FindKNodesContext * fnc) {
+static int
+find_k_nodes_dht_master_get_callback(const HashCode512 * key,
+                                    const DataContainer * cont,
+                                    void * cls) {
+  FindKNodesContext * fnc = cls;
   unsigned int pos;
   unsigned int dataLength;
   const PeerIdentity * value;
@@ -1979,7 +1992,7 @@
     LOG(LOG_WARNING,
        _("Malformed response to `%s' on master table.\n"),
        "DHT_findValue");
-    return;
+    return SYSERR;
   }
   for (pos = 0;pos<dataLength/sizeof(PeerIdentity);pos++) {
     const PeerIdentity * msg;
@@ -2004,6 +2017,7 @@
     }
     MUTEX_UNLOCK(&fnc->lock);
   }
+  return OK;
 }
 
 /**
@@ -2035,12 +2049,13 @@
  * @param closure extra argument to the callback
  * @return context for findKNodes_stop
  */
-static FindKNodesContext * findKNodes_start(const DHT_TableId * table,
-                                           const HashCode512 * key,
-                                           cron_t timeout,
-                                           unsigned int k,
-                                           NodeFoundCallback callback,
-                                           void * closure) {
+static FindKNodesContext * 
+findKNodes_start(const DHT_TableId * table,
+                const HashCode512 * key,
+                cron_t timeout,
+                unsigned int k,
+                NodeFoundCallback callback,
+                void * closure) {
   FindKNodesContext * fnc;
   int i;
   int found;
@@ -2116,7 +2131,7 @@
                            1, /* key count */
                            table, /* keys */
                            timeout,
-                           
(DataProcessor)&find_k_nodes_dht_master_get_callback,
+                           &find_k_nodes_dht_master_get_callback,
                            fnc,
                            NULL,
                            NULL);
@@ -2159,7 +2174,8 @@
  */
 static void dht_put_rpc_reply_callback(const PeerIdentity * responder,
                                       RPC_Param * results,
-                                      DHT_PUT_RECORD * record) {
+                                      void * cls) {
+  DHT_PUT_RECORD * record = cls;
   PeerIdentity * peer;
   unsigned int dataLength;
   PeerInfo * pos;
@@ -2202,8 +2218,10 @@
  * processed by the callback in record.  The RPC async handle is to be
  * stored in the records rpc list.  Locking is not required.
  */
-static void send_dht_put_rpc(const PeerIdentity * peer,
-                            DHT_PUT_RECORD * record) {
+static int 
+send_dht_put_rpc(const PeerIdentity * peer,
+                void * cls) {
+  DHT_PUT_RECORD * record = cls;
   RPC_Param * param;
   unsigned long long timeout;
   cron_t delta;
@@ -2223,7 +2241,7 @@
   if (isNotCloserThanMe(&record->table,
                        peer,           
                        &record->key))
-    return;
+    return OK;
   cronTime(&now);
   if (record->timeout > now)
     delta = (record->timeout - now) / 2;
@@ -2256,12 +2274,20 @@
                        param,
                        0,
                        delta,
-                       (RPC_Complete) &dht_put_rpc_reply_callback,
+                       &dht_put_rpc_reply_callback,
                        record);
   RPC_paramFree(param);
+  return OK;
 }
 
+static void
+dht_put_async_timeout(void * cls) {
+  struct DHT_PUT_RECORD * dpr = cls;
+  dpr->callback(dpr->closure);
+  delAbortJob(&dht_put_async_timeout, cls);
+}
 
+
 /**
  * Perform an asynchronous PUT operation on the DHT identified by
  * 'table' storing a binding of 'key' to 'value'.  The peer does not
@@ -2394,11 +2420,17 @@
                         key,
                         timeout,
                         ALPHA,
-                        (NodeFoundCallback) &send_dht_put_rpc,
+                        &send_dht_put_rpc,
                         ret);
   }
-  /* FIXME: ensure we call OP_Complete callback
-     after timeout! */
+
+  /* call OP_Complete callback after timeout! */
+  addAbortJob(&dht_put_async_timeout,
+             ret);
+  addCronJob(&dht_put_async_timeout,
+            timeout,
+            0,
+            ret);
   MUTEX_UNLOCK(lock);
   return ret;
 }
@@ -2413,6 +2445,9 @@
   if (record == NULL)
     return SYSERR;
 
+  /* cancel timeout cron job (if still live) */
+  delAbortJob(&dht_put_async_timeout, record);
+  delCronJob(&dht_put_async_timeout, 0, record);
   /* abort findKNodes (if running) - it may cause
      the addition of additional RPCs otherwise! */
   if (record->kfnc != NULL)
@@ -2437,9 +2472,11 @@
  *
  * @param results::peer created in rpc_DHT_store_abort
  */
-static void dht_remove_rpc_reply_callback(const PeerIdentity * responder,
-                                         RPC_Param * results,
-                                         DHT_REMOVE_RECORD * record) {
+static void 
+dht_remove_rpc_reply_callback(const PeerIdentity * responder,
+                             RPC_Param * results,
+                             void * cls) {
+  DHT_REMOVE_RECORD * record = cls;
   PeerIdentity * peer;
   unsigned int dataLength;
   PeerInfo * pos;
@@ -2482,8 +2519,10 @@
  * processed by the callback in record.  The RPC async handle is to be
  * stored in the records rpc list.  Locking is not required.
  */
-static void send_dht_remove_rpc(const PeerIdentity * peer,
-                               DHT_REMOVE_RECORD * record) {
+static int
+send_dht_remove_rpc(const PeerIdentity * peer,
+                   void * cls) {
+  DHT_REMOVE_RECORD * record = cls;
   RPC_Param * param;
   unsigned long long timeout;
   cron_t delta;
@@ -2503,7 +2542,7 @@
   if (isNotCloserThanMe(&record->table,
                        peer,           
                        &record->key))
-    return; /* refuse! */
+    return OK; /* refuse! */
   cronTime(&now);
   if (record->timeout > now)
     delta = (record->timeout - now) / 2;
@@ -2537,9 +2576,10 @@
                        param,
                        0,
                        delta,
-                       (RPC_Complete) &dht_remove_rpc_reply_callback,
+                       &dht_remove_rpc_reply_callback,
                        record);
   RPC_paramFree(param);
+  return OK;
 }
 
 /**
@@ -2649,7 +2689,7 @@
                         key,
                         timeout,
                         ALPHA,
-                        (NodeFoundCallback) &send_dht_remove_rpc,
+                        &send_dht_remove_rpc,
                         ret);
   }
   MUTEX_UNLOCK(lock);
@@ -2914,8 +2954,19 @@
 }
 
 static void rpc_dht_findValue_complete(RPC_DHT_FindValue_Context * ctx) {
-  /* FIXME! */
+  RPC_Param * param;
+  int i;
 
+  param = RPC_paramNew();
+  for (i=0;i<ctx->count;i++)
+    RPC_paramAdd(param,
+                "data",
+                ntohl(ctx->results[i]->size),
+                &ctx->results[i][1]);
+  ctx->callback(param,
+               0, /* error code */
+               ctx->rpc_context);
+  RPC_paramFree(param);
 }
 
 /**
@@ -2995,8 +3046,6 @@
                          fw_context,
                          (DHT_OP_Complete) &rpc_dht_findValue_complete,
                          fw_context);
-  /* FIXME: manage abort properly, also fix
-     rpc_dht_findValue_complete! */
   addAbortJob((CronJob)&rpc_DHT_findValue_abort,
              fw_context);
   addCronJob((CronJob)&rpc_DHT_findValue_abort,
@@ -3013,11 +3062,12 @@
  *
  * The result is parsed in dht_put_rpc_reply_callback.
  */
-static void rpc_DHT_store_abort(RPC_DHT_store_Context * fw) {
+static void rpc_DHT_store_abort(void * cls) {
+  RPC_DHT_store_Context * fw = cls;
   RPC_Param * results;
 
   ENTER();
-  delAbortJob((CronJob) &rpc_DHT_store_abort,
+  delAbortJob(&rpc_DHT_store_abort,
              fw);
   MUTEX_LOCK(&fw->lock);
   if (fw->done == YES) {
@@ -3047,9 +3097,21 @@
  * sending the cummulative reply via RPC.
  */
 static void rpc_dht_store_callback(RPC_DHT_store_Context * fw) {
-  /* FIXME: shutdown coordination! */
+  RPC_Param * param;
+  
+  delCronJob(&rpc_DHT_store_abort, 0, fw);
+  delAbortJob(&rpc_DHT_store_abort, fw);
+  param = RPC_paramNew();
+  fw->callback(param,
+              0,
+              fw->rpc_context);
+  RPC_paramFree(param);
+  FREE(fw);
 }
 
+/**
+ * DHT store request.
+ */
 static void rpc_DHT_store(const PeerIdentity * sender,
                          RPC_Param * arguments,
                          Async_RPC_Complete_Callback callback,
@@ -3112,11 +3174,9 @@
                          value,
                          (DHT_OP_Complete) &rpc_dht_store_callback,
                          fw_context);
-  /* FIXME: fix shutdown
-     (also fix rpc_dht_store_callback) */
-  addAbortJob((CronJob)&rpc_DHT_store_abort,
+  addAbortJob(&rpc_DHT_store_abort,
              fw_context);
-  addCronJob((CronJob)&rpc_DHT_store_abort,
+  addCronJob(&rpc_DHT_store_abort,
             ntohll(*timeout),
             0,
             fw_context);
@@ -3164,7 +3224,17 @@
  * sending the cummulative reply via RPC.
  */
 static void rpc_dht_remove_callback(RPC_DHT_remove_Context * fw) {
-  /* FIXME: shutdown sequence! */
+  RPC_Param * param;
+  
+  delCronJob(&rpc_DHT_store_abort, 0, fw);
+  delAbortJob(&rpc_DHT_store_abort, fw);
+  param = RPC_paramNew();
+
+  fw->callback(param,
+              0,
+              fw->rpc_context);
+  RPC_paramFree(param);
+  FREE(fw);
 }
 
 /**
@@ -3240,7 +3310,6 @@
                             value,
                             (DHT_OP_Complete) &rpc_dht_remove_callback,
                             fw_context);
-  /* FIXME: shutdown sequence! */
   addAbortJob((CronJob)&rpc_DHT_remove_abort,
              fw_context);
   addCronJob((CronJob)&rpc_DHT_remove_abort,
@@ -3456,7 +3525,7 @@
                              request_param,
                              0,
                              DHT_PING_FREQUENCY,
-                             (RPC_Complete) &ping_reply_handler,
+                             &ping_reply_handler,
                              NULL);
        pingTimes[pingTimesSize-1]
          = now;

Deleted: GNUnet/src/applications/dht/module/dht_test.c
===================================================================
--- GNUnet/src/applications/dht/module/dht_test.c       2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/dht/module/dht_test.c       2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -1,140 +0,0 @@
-/**
- * @file applications/dht/module/dht_test.c
- * @brief Testcase for DHT
- * @author Christian Grothoff
- *
- * The testcase is supposed to work by emulating the GNUnet core
- * (and possibly other peers).  Quiz question is: should we also
- * emulate RPC?  And how about starting *two* DHT's locally and
- * just simulating the RPC message exchange?  Do we need t fork
- * for that or can do other tricks to avoid state-sharing?
- * Fork might be bad because it would then require hacking up some
- * IPC code (then again, serializing the RPC requests should not
- * be too hard).
- */
-
-#include "gnunet_util.h"
-#include "gnunet_core.h"
-#include "gnunet_rpc_service.h"
-#include "gnunet_dht_service.h"
-#include "gnunet_dht_datastore_memory.h"
-#include "platform.h"
-
-#define ABORT() GNUNET_ASSERT(0)
-
-static DHT_ServiceAPI * dhtAPI;
-static CoreAPIForApplication dht_capi;
-static CoreAPIForApplication rpc_capi;
-static RPC_ServiceAPI * rpcAPI;
-
-DHT_ServiceAPI * provide_dht_protocol(CoreAPIForApplication * capi);
-int release_dht_protocol();
-RPC_ServiceAPI * provide_rpc_protocol(CoreAPIForApplication * capi);
-void release_rpc_protocol();
-
-static int forAllConnectedNodes(PerNodeCallback method,
-                               void * arg) {
-  return 0;
-}
-
-static void sendToNode(const PeerIdentity * hostId,
-                      const P2P_MESSAGE_HEADER * message,
-                      unsigned int priority,
-                      unsigned int maxdelay) {
-}
-
-static void * requestService(const char * pos) {
-  return NULL;
-}
-
-static int releaseService(void * service) {
-  return 0;
-}
-
-static int registerHandler(const unsigned short type,
-                          MessagePartHandler callback) {
-  return SYSERR;
-}
-
-static int unregisterHandler(const unsigned short type,
-                            MessagePartHandler callback) {
-  return SYSERR;
-}
-
-static int parseCommandLine(int argc,
-                           char * argv[]) {
-  char c;
-
-  while (1) {
-    int option_index = 0;
-    static struct GNoption long_options[] = {
-      { "config",  1, 0, 'c' },
-      { 0,0,0,0 }
-    };
-    c = GNgetopt_long(argc,
-                     argv,
-                     "c:",
-                     long_options,
-                     &option_index);
-
-    if (c == -1)
-      break;  /* No more flags to process */
-
-    switch(c) {
-    case 'c':
-      FREENONNULL(setConfigurationString("FILES",
-                                        "gnunet.conf",
-                                        GNoptarg));
-      break;
-    } /* end of parsing commandline */
-  }
-  FREENONNULL(setConfigurationString("GNUNETD",
-                                    "LOGFILE",
-                                    NULL));
-  FREENONNULL(setConfigurationString("GNUNETD",
-                                    "LOGLEVEL",
-                                    "WARNING"));
-  return OK;
-}
-
-int main(int argc,
-        char * argv[]) {
-  PeerIdentity id;
-
-  if (1)
-    return 0; /* testcase not complete, always pass for now */
-
-  makeRandomId(&id.hashPubKey);
-
-  if (OK != initUtil(argc, argv, &parseCommandLine))
-    return 1;
-
-  /* for DHT */
-  memset(&dht_capi, 0, sizeof(CoreAPIForApplication));
-  dht_capi.myIdentity = &id;
-  dht_capi.requestService = &requestService;
-  dht_capi.releaseService = &releaseService;
-  dht_capi.sendToNode = &sendToNode;
-  dht_capi.forAllConnectedNodes = &forAllConnectedNodes;
-  /* for RPC */
-  memset(&rpc_capi, 0, sizeof(CoreAPIForApplication));
-  rpc_capi.myIdentity = &id;
-  rpc_capi.registerHandler = &registerHandler;
-  rpc_capi.unregisterHandler = &unregisterHandler;
-  rpc_capi.sendToNode = &sendToNode;
-
-  rpcAPI = provide_rpc_protocol(&rpc_capi);
-  if (rpcAPI == NULL)
-    ABORT();
-  dhtAPI = provide_dht_protocol(&dht_capi);
-  if (dhtAPI == NULL)
-    ABORT();
-
-  release_rpc_protocol();
-  if (OK == release_dht_protocol())
-    return 0;
-  else
-    return 1;
-}
-
-/* end of dht_test.c */

Modified: GNUnet/src/applications/dht/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/dht/tools/Makefile.am       2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/dht/tools/Makefile.am       2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -30,11 +30,10 @@
 
 
 
-#check_PROGRAMS = \
-#  dhttest \
-#  dhttest2 
+check_PROGRAMS = \
+  dhttest2 
 
-#TESTS = $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS)
 
 #dhttest_SOURCES = \
 #  dhttest.c 
@@ -44,13 +43,13 @@
 #  
$(top_builddir)/src/applications/dht/module/libgnunetdht_datastore_memory.la \
 #  $(top_builddir)/src/util/libgnunetutil.la 
 
-#dhttest2_SOURCES = \
-#  dhttest2.c 
-#dhttest2_LDADD = \
-#  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
-#  $(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
-#  
$(top_builddir)/src/applications/dht/module/libgnunetdht_datastore_memory.la \
-#  $(top_builddir)/src/util/libgnunetutil.la 
+dhttest2_SOURCES = \
+  dhttest2.c 
+dhttest2_LDADD = \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
+  $(top_builddir)/src/applications/dht/module/libgnunetdht_datastore_memory.la 
\
+  $(top_builddir)/src/util/libgnunetutil.la 
 
 EXTRA_DIST = \
   peer1.conf \

Modified: GNUnet/src/applications/dht/tools/dhttest2.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest2.c        2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/dht/tools/dhttest2.c        2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -83,6 +83,7 @@
                     argv,
                     &parseOptions))
     return -1;
+  printf("Starting daemons (1st round)\n");
   FREENONNULL(setConfigurationString("GNUNET",
                                     "GNUNETD-CONFIG",
                                     "peer1.conf"));
@@ -105,7 +106,7 @@
       DIE_STRERROR("kill");
     GNUNET_ASSERT(OK == waitForGNUnetDaemonTermination(daemon2));
   }
-
+  printf("Re-starting daemons.\n");
   /* re-start, this time we're sure up-to-date hellos are available */
   FREENONNULL(setConfigurationString("GNUNET",
                                     "GNUNETD-CONFIG",
@@ -115,7 +116,7 @@
                                     "GNUNETD-CONFIG",
                                     "peer2.conf"));
   daemon2 = startGNUnetDaemon(NO);
-    gnunet_util_sleep(5 * cronSECONDS);
+  gnunet_util_sleep(5 * cronSECONDS);
 
   ret = 0;
   left = 5;
@@ -143,7 +144,8 @@
     CHECK(left > 0);
   }
   releaseClientSocket(sock);
-
+  printf("Peers connected.  Running actual test.\n");
+  
   memset(&table, 33, sizeof(DHT_TableId));
   DHT_LIB_init();
   store = create_blockstore_memory(65536);
@@ -155,16 +157,19 @@
     setConfigurationInt("NETWORK",
                        "PORT",
                        12087);
+    printf("Peer2 joins DHT\n");
     DHT_LIB_join(store,
                 &table);
     hash("key", 3, &key);
     value = MALLOC(8);
     value->size = ntohl(8);
+    printf("Peer2 stores key.\n");
     CHECK2(OK == DHT_LIB_put(&table,
                             &key,
                             0,
                             5 * cronSECONDS,
                             value));
+    printf("Peer2 gets key.\n");
     CHECK2(1 == DHT_LIB_get(&table,
                            0,
                            0,
@@ -175,6 +180,7 @@
                            NULL));
 
     hash("key2", 4, &key);
+    printf("Peer2 gets key2.\n");
     CHECK2(1 == DHT_LIB_get(&table,
                            0,
                            0,
@@ -183,6 +189,8 @@
                            60 * cronSECONDS,
                            NULL,
                            NULL));
+    printf("Peer2 tests successful.\n");
+    gnunet_util_sleep(30 * cronSECONDS);
   FAILURE2:
     DHT_LIB_leave(&table);
     destroy_blockstore_memory(store);
@@ -191,16 +199,19 @@
     doneUtil();
     exit(ret);
   }
+  printf("Peer1 joints DHT\n");
   DHT_LIB_join(store,
               &table);
   hash("key2", 4, &key);
   value = MALLOC(8);
   value->size = ntohl(8);
+  printf("Peer1 stores key2\n");
   CHECK(OK == DHT_LIB_put(&table,
                          &key,
                          0,
                          5 * cronSECONDS,
                          value));
+  printf("Peer1 gets key2\n");
   CHECK(1 == DHT_LIB_get(&table,
                         0,
                         0,
@@ -210,6 +221,7 @@
                         NULL,
                         NULL));
   hash("key", 3, &key);
+  printf("Peer1 gets key\n");
   CHECK(1 == DHT_LIB_get(&table,
                         0,
                         0,
@@ -218,7 +230,7 @@
                         60 * cronSECONDS,
                         NULL,
                         NULL));
-
+  printf("Peer1 tests successful, shutting down.\n");
   DHT_LIB_leave(&table);
   destroy_blockstore_memory(store);
   DHT_LIB_done();

Modified: GNUnet/src/applications/dht/tools/peer1.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer1.conf        2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/dht/tools/peer1.conf        2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -5,7 +5,7 @@
 GNUNETD_HOME     = peer1
 # VALGRIND        = 300
 HELLOEXPIRES     = 60
-LOGLEVEL        = WARNING
+LOGLEVEL        = DEBUG
 LOGFILE         = $GNUNETD_HOME/log
 KEEPLOG         = 0
 PIDFILE         = $GNUNETD_HOME/gnunetd.pid
@@ -21,6 +21,7 @@
 INTERFACE = eth0
 HELOEXCHANGE = NO
 TRUSTED = 127.0.0.0/8;
+IP = 127.0.0.1
 
 [LOAD]
 INTERFACES          = eth0

Modified: GNUnet/src/applications/dht/tools/peer2.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer2.conf        2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/dht/tools/peer2.conf        2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -4,8 +4,8 @@
 [GNUNETD]
 GNUNETD_HOME     = peer2
 # VALGRIND        = 300
-HELLOEXPIRES     = 60
-LOGLEVEL        = WARNING
+HELLOEXPIRES    = 60
+LOGLEVEL        = DEBUG
 LOGFILE         = $GNUNETD_HOME/log
 KEEPLOG         = 0
 PIDFILE         = $GNUNETD_HOME/gnunetd.pid
@@ -21,6 +21,7 @@
 INTERFACE = eth0
 HELOEXCHANGE = NO
 TRUSTED = 127.0.0.0/8;
+IP = 127.0.0.1
 
 [LOAD]
 INTERFACES          = eth0

Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2006-01-01 08:39:24 UTC 
(rev 2430)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2006-01-01 10:21:05 UTC 
(rev 2431)
@@ -146,12 +146,30 @@
                                         "AUTOMATE",
                                         "STOP"));
       break;
-    case 'k':
-      /* TODO: support using -k multiple times! */
+    case 'k': {
+      char * old;
+      char * nw;
+      size_t s;
+
+      old = getConfigurationString("PSEUDONYM",
+                                  "KEYWORD");
+      if (old == NULL) {
+       nw = STRDUP(GNoptarg);
+      } else {
+       s = strlen(old) + strlen(GNoptarg) + 3 + strlen(_("AND"));
+       nw = MALLOC(s);
+       SNPRINTF(nw, 
+                s,
+                "%s %s %s",
+                old, _("AND"), GNoptarg);
+       FREE(old);
+      }
       FREENONNULL(setConfigurationString("PSEUDONYM",
                                         "KEYWORD",
-                                        GNoptarg));
+                                        nw));
+      FREE(nw);
       break;
+    }
     case 'h':
       printhelp();
       return SYSERR;

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-01-01 08:39:24 UTC (rev 2430)
+++ GNUnet/todo 2006-01-01 10:21:05 UTC (rev 2431)
@@ -11,53 +11,48 @@
   Oh, and this is of course just a plan.  And plans always change.
 
 
-0.7.0b [12'05] (aka "bugfixes")
+0.7.1 [2'06] (aka "stabilization")
 - known bugs (see Mantis for updates):
   * gnunet-setup memory leaks (#878)
-  * gnunet-setup category switch update bug (#892)
-  * 0 bandwidth cap (#971)
+  * gnunet-setup category switch update bug (#892)  [ RC ]
+  * file/socket leak
+  * Windows installer, uninstall: Remove account [Nils, RC]
 - testing:
+  * make dht tests work (and write more) [ CG, RC ]
   * more "make check" targets to test: 
-    + gnunet-tracekit
-    + gap and economy
-    + FSUI collections
-    + FSUI recursive uploads and downloads (incl. persistence)
+    + gap and economy  [ RC ]
+    + FSUI URI tracking [ RC ]
+    + FSUI recursive uploads and downloads (incl. persistence) [ RC ]
     + FSUI namespaces
-    + FSUI URI tracking
+    + FSUI collections
+    + gnunet-tracekit
 
-0.7.1 [12'05] (aka "stabilization"):
-- gnunet-setup:
-  * php-ification for i18n [ Nils, not RC ]
-- DHT:
-  * make dht tests work
-  * XFS [ location URIs ]
-- support using -k multiple times in gnunet-pseudonym
-- Windows installer [Nils, not RC]
-  * Uninstall: Remove account
-
-0.7.2 [1'06] (aka "performance"):
+0.7.2 [4'06] (aka "performance"):
 - Optimizations:
+  * cache some kblock-public/private keys in memory [ CG, RC ]
+    (1024 bit keys are much better than the 2048 bit keys,
+     but this would give another performance boost, especially for
+     insertion of zip files with hundreds of files/keywords!)
   * directories can be compacted -- add heuristic to determine
     if we should NOT padd with zeros (if we would waste too
     much space).  Needs some lookahead for size of remaining
     directory entries. (theoretically can compact some directories
     by 50% (?) -- incidentially 25% is what gzip can do on the
-    current directories!)
-- DHT optimizations [ use additional optional fields (HELOs) ]
-- maybe: cache kblock-public/private keys 
-    (1024 bit keys are much better than the 2048 bit keys,
-     but this would give another performance boost, especially for
-     insertion of zip files with hundreds of files/keywords!)
+    current directories!) [ CG ]
+  * DHT: use additional optional fields (HELLOs) [ CG ]
+- XFS / support for location URIs [CG, RC]
+- gnunet-setup:
+  * php-ification for i18n [ Nils, RC? ]
 
-0.7.2 [3'06] (aka "features"):
+0.7.3 [5'06] (aka "features"):
 - #747 (sharing stats for gnunet-gtk)
 - insert meta-data under hash (md5? sha1? sha-512? GNUnet-URI?)
   as keyword (to allow getting meta-data from URI only)
 - Documentation:
   * LJ article
 
-0.7.3 [5'06] (aka "advanced features"):
-- gnunet-chat
+0.7.4 [6'06] (aka "advanced features"):
+- gnunet-chat [ RC ]
 - Insert/Index a "shared directory" automatically [Nils]
 - https://gnunet.org/drupal/?q=node/97
 

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2006-01-01 08:39:24 UTC (rev 2430)
+++ gnunet-gtk/TODO     2006-01-01 10:21:05 UTC (rev 2431)
@@ -1,36 +1,41 @@
 0.7.1:
-1) create directory from known file IDs [ medium ]
-2) disable inactive buttons (if no search/download 
-   is selected to operate on) [ medium ]
-3) more help-texts (glade) [ easy ]
-4) highlight completed downloads [ easy ]
-5) highlight active downloads in search list [ easy ]
-6) pop-up dialogs / context menus (show extra information,
-   in particular full metadata) [ medium ]
-7) chat [ difficult ]
-8) show content of current collection
-9) various minor memory leaks (see FIXME in search.c,
-   #if 0 code in namespace.c)
+- create directory from known file IDs [ medium ]
+  in Assemble Directory's Files Available/Selected
+  + have sortability
+  + have multiselection
+  + print filenames as well
+- disable inactive buttons (if no search/download 
+  is selected to operate on) [ medium ]
+- more help-texts (glade) [ easy ]
+- highlight active downloads in search list [ easy ]
 
+0.7.2:
+- various minor memory leaks (see FIXME in search.c,
+  #if 0 code in namespace.c)
 
-gnunet-gtk wishlist (from pre-0.7.0 days):
-- add option to list all indexed files and perhaps delete from them
-  (ECRS now supports listing of indexed files!)
+0.7.3:
+- show content of current collection
+- highlight completed downloads [ easy ]
+- pop-up dialogs / context menus (show extra information,
+  in particular full metadata) [ medium ]
+- add right button popup menu operations for
+    Select by pattern
+  in the search result list.
 - for potentially long clists, add option to specify a string
   pattern that must be matched for the lines to be displayed
   (to further prune search results, for example)
+
+0.7.4:
+- chat [ difficult ]
+- add option to list all indexed files and delete from them
+  (ECRS now supports listing of indexed files!)
 - implement search bookmarking (e.g. user could add/edit/delete
   favourite namespace/key etc combinations)
-- in Assemble Directory's Files Available/Selected
-    Add sortability
-    Add multiselection
-    Print filenames as well
-- add right button popup menu operations for
-    Select by pattern
-  in the search result list.
+
+
+1.0.0:
 - a completely new interactive namespace/directory building
   module that would allow importing files/directories from
   disk and edit various parameters, file descriptions and
   the dir tree structure before the insertion.
-- give user opportunity to change namespace rating after
-  namespace download succeeded
+





reply via email to

[Prev in Thread] Current Thread [Next in Thread]