gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1146 - in GNUnet/src: applications/session applications/to


From: grothoff
Subject: [GNUnet-SVN] r1146 - in GNUnet/src: applications/session applications/topology_default server
Date: Thu, 30 Jun 2005 02:16:47 -0700 (PDT)

Author: grothoff
Date: 2005-06-30 02:16:42 -0700 (Thu, 30 Jun 2005)
New Revision: 1146

Modified:
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/server/connection.c
Log:
debug code and a tiny bugfix

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2005-06-29 21:08:44 UTC (rev 
1145)
+++ GNUnet/src/applications/session/connect.c   2005-06-30 09:16:42 UTC (rev 
1146)
@@ -616,11 +616,27 @@
  *         NO if we're going to try to establish one asynchronously
  */
 static int tryConnect(const PeerIdentity * peer) {
+  EncName enc;
+
+  IFLOG(LOG_DEBUG,
+       hash2enc(&peer->hashPubKey,
+                &enc));
   if ( (topology != NULL) &&
-       (topology->allowConnectionFrom(peer) == SYSERR) )
+       (topology->allowConnectionFrom(peer) == SYSERR) ) {
+    LOG(LOG_DEBUG,
+       "Topology rejected connecting to '%s'.\n",
+       &enc);
     return SYSERR;
-  if (coreAPI->queryBPMfromPeer(peer) != 0)
+  }
+  if (coreAPI->queryBPMfromPeer(peer) != 0) {
+    LOG(LOG_DEBUG,
+       "Connection to '%s' already up (have BPM limit)\n",
+       &enc);
     return YES; /* trivial case */
+  }
+  LOG(LOG_DEBUG,
+      "Trying to exchange key with '%s'.\n",
+      &enc);
   if (OK == exchangeKey(peer, NULL, NULL))
     return NO;
   else

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-06-29 21:08:44 UTC 
(rev 1145)
+++ GNUnet/src/applications/topology_default/topology.c 2005-06-30 09:16:42 UTC 
(rev 1146)
@@ -157,8 +157,12 @@
   identity->forEachHost(now,
                        (HostIterator)&scanHelperCount,
                        &indexMatch);
-  if (indexMatch.matchCount == 0)
+  if (indexMatch.matchCount == 0) {
+    LOG(LOG_EVERYTHING,
+       "No peers found for slot %u\n",
+       index);
     return; /* no matching peers found! */
+  }
   if (indexMatch.costSelector > 0)
     indexMatch.costSelector
       = randomi(indexMatch.costSelector/4)*4;
@@ -178,8 +182,9 @@
   hash2enc(&indexMatch.match.hashPubKey,
           &enc);
   LOG(LOG_DEBUG,
-      "Topology: trying to connect to '%s'.\n",
-      &enc);
+      "Topology: trying to connect to '%s' in slot '%u'.\n",
+      &enc,
+      index);
   coreAPI->unicast(&indexMatch.match,
                   NULL,
                   0,

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-06-29 21:08:44 UTC (rev 1145)
+++ GNUnet/src/server/connection.c      2005-06-30 09:16:42 UTC (rev 1146)
@@ -2695,7 +2695,8 @@
        hash2enc(&hostId->hashPubKey,
                 &enc));
   LOG(LOG_DEBUG,
-      "unicast: sending message to host %s message of size %d\n",
+      "%s: sending message to host %s message of size %d\n",
+      __FUNCTION__,
       &enc,
       len);
 #endif
@@ -2736,6 +2737,9 @@
   unsigned short len;
 
   if (msg == NULL) {
+    /* little hack for topology,
+       which cannot do this directly
+       due to cyclic dependencies! */
     session->tryConnect(receiver);
     return;
   }
@@ -2801,12 +2805,13 @@
   MUTEX_LOCK(&lock);
   be = lookForHost(node);
   if ( (be != NULL) &&
-       (be->status != STAT_UP) ) {
+       (be->status == STAT_UP) ) {
     ret = be->idealized_limit;
     if (ret == 0)
       ret = 1;
-  } else
+  } else {
     ret = 0;
+  }
   MUTEX_UNLOCK(&lock);
   return ret;
 }





reply via email to

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