gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1382 - in GNUnet/src: applications/topology_default server


From: grothoff
Subject: [GNUnet-SVN] r1382 - in GNUnet/src: applications/topology_default server
Date: Sun, 10 Jul 2005 16:43:35 -0700 (PDT)

Author: grothoff
Date: 2005-07-10 16:43:31 -0700 (Sun, 10 Jul 2005)
New Revision: 1382

Modified:
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/server/connection.c
Log:
only try to establish new session if we do not already have one

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-07-10 23:36:09 UTC 
(rev 1381)
+++ GNUnet/src/applications/topology_default/topology.c 2005-07-10 23:43:31 UTC 
(rev 1382)
@@ -104,10 +104,13 @@
                            void * data) {
   IndexMatch * im = data;
 
-  if (hostIdentityEquals(coreAPI->myIdentity, id))
+  if (hostIdentityEquals(coreAPI->myIdentity,
+                        id))
     return;
   if (coreAPI->computeIndex(id) != im->index)
     return;
+  if (0 != coreAPI->queryBPMfromPeer(id))
+    return;
   if (YES == transport->isAvailable(proto)) {
     im->matchCount++;
     im->costSelector += transport->getCost(proto);
@@ -132,6 +135,8 @@
     return;
   if (coreAPI->computeIndex(id) != im->index)
     return;
+  if (0 != coreAPI->queryBPMfromPeer(id))
+    return;
   if (YES == transport->isAvailable(proto)) {
     im->costSelector -= transport->getCost(proto);
     if ( (im->matchCount == 0) ||
@@ -178,10 +183,8 @@
                        &scanHelperSelect,
                        &indexMatch);
   if (hostIdentityEquals(coreAPI->myIdentity,
-                        &indexMatch.match)) {
-    BREAK(); /* should not happen, at least not often... */
-    return;
-  }
+                        &indexMatch.match)) 
+    return; /* should happen really rarely */  
   if (coreAPI->computeIndex(&indexMatch.match) != index) {
     BREAK(); /* should REALLY not happen */
     return;

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-07-10 23:36:09 UTC (rev 1381)
+++ GNUnet/src/server/connection.c      2005-07-10 23:43:31 UTC (rev 1382)
@@ -2855,18 +2855,21 @@
   char * closure;
   unsigned short len;
 
-  if (msg == NULL) {
+  if (msg == NULL) {    
     /* little hack for topology,
        which cannot do this directly
        due to cyclic dependencies! */
-    session->tryConnect(receiver);
+    if (getBandwidthAssignedTo(receiver) == 0)
+      session->tryConnect(receiver);
     return;
   }
   len = ntohs(msg->size);
   if (len == 0)
     return;
   closure = MALLOC(len);
-  memcpy(closure, msg, len);
+  memcpy(closure, 
+        msg,
+        len);
   unicastCallback(receiver,
                  &copyCallback,
                  closure,





reply via email to

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