gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4880 - in GNUnet: . contrib src/applications/advertising s


From: gnunet
Subject: [GNUnet-SVN] r4880 - in GNUnet: . contrib src/applications/advertising src/applications/dht/module src/applications/gap src/applications/identity src/applications/session src/applications/topology_default src/include src/server src/transports
Date: Thu, 31 May 2007 20:55:08 -0600 (MDT)

Author: grothoff
Date: 2007-05-31 20:55:07 -0600 (Thu, 31 May 2007)
New Revision: 4880

Modified:
   GNUnet/contrib/config-client.scm
   GNUnet/src/applications/advertising/advertising.c
   GNUnet/src/applications/dht/module/table.c
   GNUnet/src/applications/gap/gap.c
   GNUnet/src/applications/gap/gaptest2.c
   GNUnet/src/applications/gap/gaptest3.c
   GNUnet/src/applications/identity/clientapi.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/identity/identity.h
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/include/gnunet_core.h
   GNUnet/src/include/gnunet_identity_lib.h
   GNUnet/src/include/gnunet_uritrack_lib.h
   GNUnet/src/server/connection.c
   GNUnet/src/server/connection.h
   GNUnet/src/server/core.c
   GNUnet/src/transports/tcp_helper.c
   GNUnet/todo
Log:
enhancing identity api

Modified: GNUnet/contrib/config-client.scm
===================================================================
--- GNUnet/contrib/config-client.scm    2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/contrib/config-client.scm    2007-06-01 02:55:07 UTC (rev 4880)
@@ -286,8 +286,8 @@
   (_ "Load the about plugin for the about dialog.  The daemon plugin allows 
starting and stopping of gnunetd and displays information about gnunetd.  The 
fs plugin provides the file-sharing functionality.  The stats plugin displays 
various statistics about gnunetd.")
   '()
   #t 
-  "about daemon fs stats" 
-  (list "MC" "about" "daemon" "fs" "stats")
+  "about daemon fs peers stats" 
+  (list "MC" "about" "daemon" "fs" "peers" "stats")
   'advanced) )
 
 (define (gnunet-gtk-stats-interval builder)
@@ -315,6 +315,19 @@
    #f
    'fs-loaded) )
 
+(define (gnunet-gtk-previews builder) 
+ (builder
+   "GNUNET-GTK"
+   "DISABLE-OWN"
+   (_ "Do not show search results for files that were uploaded by us")
+   (_ "This option is useful to eliminate files that the user already has from 
the search.  Naturally, enabling this option maybe confusing because some 
obviously expected search results would no longer show up.  This option only 
works if the URI_DB_SIZE option under FS is not zero (since the URI DB is used 
to determine which files the user is sharing)")
+   '()
+   #t
+   #t
+   #f
+   'fs-loaded) )
+
+
 (define (gnunet-gtk-incomingdir builder)
  (builder
   "FS"

Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c   2007-05-31 07:31:35 UTC 
(rev 4879)
+++ GNUnet/src/applications/advertising/advertising.c   2007-06-01 02:55:07 UTC 
(rev 4880)
@@ -413,7 +413,7 @@
   prio = (int) getConnectPriority();
   if (prio >= EXTREME_PRIORITY)
     prio = EXTREME_PRIORITY / 4;
-  if (0 != coreAPI->queryBPMfromPeer(hi)) {
+  if (OK == coreAPI->queryPeerStatus(hi, NULL, NULL)) {
     coreAPI->unicast(hi,
                     &sd->m->header,
                     prio,
@@ -643,7 +643,7 @@
 static void
 forwardhello(void * unused) {
   int count;
-
+  
   if (os_cpu_get_load(coreAPI->ectx,
                      coreAPI->cfg) > 100)
     return; /* CPU load too high... */

Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c  2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/dht/module/table.c  2007-06-01 02:55:07 UTC (rev 
4880)
@@ -589,7 +589,7 @@
   }
   FREE(hello);
   /* check if connected, if not, send discovery */
-  if (0 == coreAPI->queryBPMfromPeer(peer)) {
+  if (OK != coreAPI->queryPeerStatus(peer, NULL, NULL)) {
     /* not yet connected; connect sending DISCOVERY */
     broadcast_dht_discovery(peer,
                            NULL);

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/applications/gap/gap.c   2007-06-01 02:55:07 UTC (rev 4880)
@@ -543,7 +543,7 @@
                           void * cls) {
   const QueryRecord * qr = cls;
   PID_INDEX id;
-#if DEBUG_GAP
+#if DEBUG_GAP 
   EncName encq;
   EncName encp;
 #endif
@@ -1338,7 +1338,8 @@
 #endif
 
   if (stats != NULL)
-    stats->change(stat_routing_successes, 1);
+    stats->change(stat_routing_successes, 
+                 1);
   now = get_time();
   if (now < ite->ttl)
     maxDelay = ite->ttl - now;
@@ -1472,8 +1473,8 @@
 #endif
 
   /* Load above hard limit? */
-  if (loadTooHigh())
-    return SYSERR;
+  if (loadTooHigh()) 
+    return SYSERR;  
 
   senderID = intern_pid(sender);
   GE_ASSERT(ectx,  (senderID != 0) || (sender == NULL) );

Modified: GNUnet/src/applications/gap/gaptest2.c
===================================================================
--- GNUnet/src/applications/gap/gaptest2.c      2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/gap/gaptest2.c      2007-06-01 02:55:07 UTC (rev 
4880)
@@ -150,7 +150,7 @@
                    cfg,
                    *uri,
                    1,
-                   15 * cronSECONDS,
+                   150 * cronSECONDS,
                    &searchCB,
                    &myURI,
                    &testTerminate,
@@ -296,7 +296,9 @@
                                    "HOST",
                                    "localhost:32087");
   CHECK(OK == searchFile(&uri));
+  printf("Search successful!\n");
   CHECK(OK == downloadFile(12345, uri));
+  printf("Download successful!\n");
   ECRS_freeUri(uri);
   GC_set_configuration_value_string(cfg,
                                    ectx,

Modified: GNUnet/src/applications/gap/gaptest3.c
===================================================================
--- GNUnet/src/applications/gap/gaptest3.c      2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/gap/gaptest3.c      2007-06-01 02:55:07 UTC (rev 
4880)
@@ -37,11 +37,11 @@
 
 
 
-#define PEER_COUNT 10
+#define PEER_COUNT 4
 
 #define START_PEERS 1
 
-#define SIZE 1024*1024*100
+#define SIZE 1024*1024*1
 
 static struct GE_Context * ectx;
 
@@ -178,12 +178,12 @@
   hash2enc(&identity->hashPubKey,
           &enc);
   if (good) 
-    printf("Good peer `%s' has trust %u and bandwidth %u\n", 
+    printf("Good peer `%8s' has trust %u and bandwidth %u\n", 
           (const char*) &enc,
           trust,
           bpmFromPeer);
   else
-    printf("Poor peer `%s' has trust %u and bandwidth %u\n",
+    printf("Poor peer `%8s' has trust %u and bandwidth %u\n",
           (const char*) &enc,
           trust,
           bpmFromPeer);
@@ -263,7 +263,7 @@
       ECRS_freeUri(uri);
     hash2enc(&hello->senderIdentity.hashPubKey,
             &enc);
-    printf("Uploading to peer `%s'\n", 
+    printf("Uploading to peer `%8s'\n", 
           (const char*)&enc);
     uri = uploadFile(SIZE);
     CHECK(NULL != uri);

Modified: GNUnet/src/applications/identity/clientapi.c
===================================================================
--- GNUnet/src/applications/identity/clientapi.c        2007-05-31 07:31:35 UTC 
(rev 4879)
+++ GNUnet/src/applications/identity/clientapi.c        2007-06-01 02:55:07 UTC 
(rev 4880)
@@ -209,6 +209,7 @@
       if (OK != callback(cls,
                         &info->peer,
                         (const char*) &info[1],
+                        ntohll(info->last_message),
                         ntohl(info->trust),
                         ntohl(info->bpm))) {
        FREE(reply);

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/identity/identity.c 2007-06-01 02:55:07 UTC (rev 
4880)
@@ -1109,7 +1109,7 @@
 static int identityRequestConnectHandler(struct ClientHandle * sock,
                                         const MESSAGE_HEADER * message) {
   const CS_identity_connect_MESSAGE * msg;
-  unsigned int bpm;
+  int ret;
 
   if (sizeof(CS_identity_connect_MESSAGE) != ntohs(message->size))
     return SYSERR;
@@ -1118,9 +1118,11 @@
                   NULL,
                   0,
                   0);
-  bpm = coreAPI->queryBPMfromPeer(&msg->other);
+  ret = coreAPI->queryPeerStatus(&msg->other,
+                                NULL,
+                                NULL);
   return coreAPI->sendValueToClient(sock,
-                                   bpm == 0 ? NO : YES);
+                                   ret != OK ? NO : YES);
 }
 
 static int identityHelloHandler(struct ClientHandle * sock,
@@ -1218,6 +1220,8 @@
   P2P_hello_MESSAGE * hello;
   char * address;
   int ret;
+  unsigned int bpm;
+  cron_t last;
   
   if (confirmed == NO)
     return OK;
@@ -1236,12 +1240,19 @@
     FREE(address);
     address = STRDUP("invalid");
   }
+  if (OK != coreAPI->queryPeerStatus(identity,
+                                    &bpm,
+                                    &last)) {
+    last = 0;
+    bpm = 0;
+  }
   reply = MALLOC(sizeof(CS_identity_peer_info_MESSAGE) + strlen(address) + 1);
   reply->header.size = htons(sizeof(CS_identity_peer_info_MESSAGE) + 
strlen(address) + 1);
   reply->header.type = htons(CS_PROTO_identity_INFO);
   reply->peer = *identity;
+  reply->last_message = htonll(last);
   reply->trust = htonl(getHostTrust(identity));
-  reply->bpm = htonl(coreAPI->queryBPMfromPeer(identity));
+  reply->bpm = htonl(bpm);
   memcpy(&reply[1],
         address,
         strlen(address) + 1);

Modified: GNUnet/src/applications/identity/identity.h
===================================================================
--- GNUnet/src/applications/identity/identity.h 2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/identity/identity.h 2007-06-01 02:55:07 UTC (rev 
4880)
@@ -54,10 +54,12 @@
 typedef struct {
   MESSAGE_HEADER header;
 
+  unsigned int trust;
+
   PeerIdentity peer;
 
-  unsigned int trust;
-
+  cron_t last_message;
+  
   unsigned int bpm;
 } CS_identity_peer_info_MESSAGE;
 

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/applications/session/connect.c   2007-06-01 02:55:07 UTC (rev 
4880)
@@ -800,11 +800,11 @@
 #endif
     return SYSERR;
   }
-  if (coreAPI->queryBPMfromPeer(peer) != 0) {
+  if (coreAPI->queryPeerStatus(peer, NULL, NULL) == OK) {
 #if DEBUG_SESSION
     GE_LOG(ectx,
           GE_DEBUG | GE_USER | GE_REQUEST,
-          "Connection to `%s' already up (have BPM limit)\n",
+          "Connection to `%s' already up\n",
           &enc);
 #endif
     return YES; /* trivial case */

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-05-31 07:31:35 UTC 
(rev 4879)
+++ GNUnet/src/applications/topology_default/topology.c 2007-06-01 02:55:07 UTC 
(rev 4880)
@@ -113,7 +113,7 @@
     return OK;
   if (coreAPI->computeIndex(id) != im->index)
     return OK;
-  if (0 != coreAPI->queryBPMfromPeer(id))
+  if (OK == coreAPI->queryPeerStatus(id, NULL, NULL))
     return OK;
   if (YES == transport->isAvailable(proto)) {
     im->matchCount++;
@@ -142,7 +142,7 @@
     return OK;
   if (coreAPI->computeIndex(id) != im->index)
     return OK;
-  if (0 != coreAPI->queryBPMfromPeer(id))
+  if (OK == coreAPI->queryPeerStatus(id, NULL, NULL))
     return OK;
   if (YES == transport->isAvailable(proto)) {
     im->costSelector -= transport->getCost(proto);

Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h    2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/include/gnunet_core.h    2007-06-01 02:55:07 UTC (rev 4880)
@@ -486,12 +486,14 @@
    * Query how much bandwidth is availabe FROM the given node to
    * this node in bpm (at the moment).
    *
-   * @return 0 only if we are NOT connected at all,
-   *  this way, this method can be used to test if we
-   *  are currently connected to a peer.
+   * @param bpm set to the bandwidth
+   * @param last_seen set to last time peer was confirmed up
+   * @return OK on success, SYSERR if if we are NOT connected
    */
-  unsigned int (*queryBPMfromPeer)(const PeerIdentity * node);
-
+  int (*queryPeerStatus)(const PeerIdentity * node,
+                        unsigned int * bpm,
+                        cron_t * last_seen);
+  
   /**
    * Disconnect a particular peer. Sends a HANGUP message to the other
    * side and marks all sessionkeys as dead.

Modified: GNUnet/src/include/gnunet_identity_lib.h
===================================================================
--- GNUnet/src/include/gnunet_identity_lib.h    2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/include/gnunet_identity_lib.h    2007-06-01 02:55:07 UTC (rev 
4880)
@@ -83,6 +83,8 @@
  * @param address address of the peer (as given by the
  *        transport; likely to be an IP+PORT, but could
  *        be anything!)
+ * @param last_message if currently connected, when did we
+ *        hear last from this peer (estimate)
  * @param bpmFromPeer 0 if peer is not connected, otherwise 
  *        number of bytes per minute that we currently allow
  *        this peer to sent to us
@@ -92,6 +94,7 @@
 typedef int (*GNUnetIdentityPeerInfoCallback)(void * data,
                                              const PeerIdentity * identity,
                                              const char * address,
+                                             cron_t last_message,
                                              unsigned int trust,
                                              unsigned int bpmFromPeer);
 

Modified: GNUnet/src/include/gnunet_uritrack_lib.h
===================================================================
--- GNUnet/src/include/gnunet_uritrack_lib.h    2007-05-31 07:31:35 UTC (rev 
4879)
+++ GNUnet/src/include/gnunet_uritrack_lib.h    2007-06-01 02:55:07 UTC (rev 
4880)
@@ -105,13 +105,13 @@
  */
 enum URITRACK_STATE {
   URITRACK_FRESH              =    0,
-  URITRACK_INSERTED           =    1, // done, FSUI
-  URITRACK_INDEXED            =    2, // done, FSUI
-  URITRACK_DIRECTORY_ADDED    =    4, // done, FSUI
-  URITRACK_DOWNLOAD_STARTED   =    8, // done, FSUI
-  URITRACK_DOWNLOAD_ABORTED   =   16, // done, FSUI
-  URITRACK_DOWNLOAD_COMPLETED =   32, // done, FSUI
-  URITRACK_SEARCH_RESULT      =   64, // done, FSUI
+  URITRACK_INSERTED           =    1,
+  URITRACK_INDEXED            =    2,
+  URITRACK_DIRECTORY_ADDED    =    4,
+  URITRACK_DOWNLOAD_STARTED   =    8,
+  URITRACK_DOWNLOAD_ABORTED   =   16,
+  URITRACK_DOWNLOAD_COMPLETED =   32,
+  URITRACK_SEARCH_RESULT      =   64,
   URITRACK_DIRECTORY_FOUND    =  128,
 };
 

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/server/connection.c      2007-06-01 02:55:07 UTC (rev 4880)
@@ -375,7 +375,7 @@
 
   /**
    * is this host alive? timestamp of the time of the last-active
-   * point (as witnessed by some higher-level application, typically
+  * point (as witnessed by some higher-level application, typically
    * topology+pingpong)
    */
   cron_t isAlive;
@@ -3549,7 +3549,7 @@
     /* little hack for topology,
        which cannot do this directly
        due to cyclic dependencies! */
-    if (getBandwidthAssignedTo(receiver) == 0)
+    if (getBandwidthAssignedTo(receiver, NULL, NULL) != OK)
       session->tryConnect(receiver);
     return;
   }
@@ -3610,7 +3610,9 @@
   return lock;
 }
 
-unsigned int getBandwidthAssignedTo(const PeerIdentity * node) {
+int getBandwidthAssignedTo(const PeerIdentity * node,
+                          unsigned int * bpm,
+                          cron_t * last_seen) {
   BufferEntry *be;
   unsigned int ret;
 
@@ -3619,11 +3621,13 @@
   be = lookForHost(node);
   if ( (be != NULL) &&
        (be->status == STAT_UP) ) {
-    ret = be->idealized_limit;
-    if(ret == 0)
-      ret = 1;
+    if (bpm != NULL)
+      *bpm = be->idealized_limit;
+    if (last_seen != NULL)
+      *last_seen = be->isAlive;
+    ret = OK;
   } else {
-    ret = 0;
+    ret = SYSERR;
   }
   MUTEX_UNLOCK(lock);
   return ret;

Modified: GNUnet/src/server/connection.h
===================================================================
--- GNUnet/src/server/connection.h      2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/server/connection.h      2007-06-01 02:55:07 UTC (rev 4880)
@@ -209,7 +209,9 @@
  * How many bpm did we assign this peer (how much traffic
  * may the given peer send to us per minute?)
  */
-unsigned int getBandwidthAssignedTo(const PeerIdentity * hostId);
+int getBandwidthAssignedTo(const PeerIdentity * hostId,
+                          unsigned int * bpm,
+                          cron_t * last_seen);
 
 /**
  * Increase the preference for traffic from some other peer.

Modified: GNUnet/src/server/core.c
===================================================================
--- GNUnet/src/server/core.c    2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/server/core.c    2007-06-01 02:55:07 UTC (rev 4880)
@@ -514,7 +514,7 @@
   applicationCore.getCurrentSessionKey = &getCurrentSessionKey; /* 
connection.c */
   applicationCore.confirmSessionUp = &confirmSessionUp; /* connection.c */
   applicationCore.preferTrafficFrom = &updateTrafficPreference; /* 
connection.c */
-  applicationCore.queryBPMfromPeer = &getBandwidthAssignedTo; /* connection.c 
*/
+  applicationCore.queryPeerStatus = &getBandwidthAssignedTo; /* connection.c */
   applicationCore.disconnectFromPeer = &disconnectFromPeer; /* connection.c */
 
   applicationCore.sendValueToClient = &sendTCPResultToClient; /* tcpserver.c */

Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c  2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/src/transports/tcp_helper.c  2007-06-01 02:55:07 UTC (rev 4880)
@@ -349,7 +349,7 @@
   if ( (OK == ok) &&
        (stats != NULL) )
     stats->change(stat_bytesSent,
-                 size);
+                 size + sizeof(MESSAGE_HEADER));
 
   FREE(mp);
   return ok;

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2007-05-31 07:31:35 UTC (rev 4879)
+++ GNUnet/todo 2007-06-01 02:55:07 UTC (rev 4880)
@@ -13,10 +13,9 @@
 
 0.7.2 [5'07]:
 - new features:
-  * XFS -- TEST more! [RC] 
-  * HTTP transport (libcurl, libmicrohttpd)
-- testcases (fix, add):
-  * implement gap economy testcase [RC]
+  * HTTP transport (libcurl, libmicrohttpd) [#765] [likely 0.7.2a]
+- Testcases:
+  * XFS -- more testing would be good...    [likely 0.7.2a]
 
 
 0.7.3 [7'07] (aka "features"):
@@ -39,8 +38,9 @@
 - gnunet-chat [ RC ]
 - Insert/Index a "shared directory" automatically [Nils]
   See also: https://gnunet.org/drupal/?q=node/97
+- guard friendly connection count (#1018)
+- power insert [#854?]
 
-
 1.0.0 (aka "userfriendly"):
 - implement testbed for profiling
 





reply via email to

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