gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5192 - in GNUnet/src: applications/gap applications/identi


From: gnunet
Subject: [GNUnet-SVN] r5192 - in GNUnet/src: applications/gap applications/identity applications/session applications/topology_default server
Date: Sun, 1 Jul 2007 00:58:40 -0600 (MDT)

Author: grothoff
Date: 2007-07-01 00:58:33 -0600 (Sun, 01 Jul 2007)
New Revision: 5192

Modified:
   GNUnet/src/applications/gap/gap.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/session/sessiontest.c
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/server/connection.c
   GNUnet/src/server/handler.c
Log:
hacking

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2007-07-01 03:13:10 UTC (rev 5191)
+++ GNUnet/src/applications/gap/gap.c   2007-07-01 06:58:33 UTC (rev 5192)
@@ -1603,8 +1603,6 @@
     GE_BREAK_OP(ectx, 0);
     return SYSERR; /* invalid! */
   }
-  if (host != NULL)
-    coreAPI->confirmSessionUp(host);
   msg = (const P2P_gap_reply_MESSAGE *) pmsg;
 #if DEBUG_GAP
   IF_GELOG(ectx,
@@ -1979,8 +1977,6 @@
     GE_BREAK(ectx, 0);
     return 0;
   }
-  if (sender != NULL)
-    coreAPI->confirmSessionUp(sender);
   /* Load above hard limit? */
   if (loadTooHigh()) {
 #if DEBUG_GAP

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-07-01 03:13:10 UTC (rev 
5191)
+++ GNUnet/src/applications/identity/identity.c 2007-07-01 06:58:33 UTC (rev 
5192)
@@ -40,7 +40,7 @@
 #include "identity.h"
 #include "hostkey.h"
 
-#define DEBUG_IDENTITY NO
+#define DEBUG_IDENTITY YES
 
 #define MAX_TEMP_HOSTS 32
 
@@ -860,16 +860,18 @@
     return SYSERR;
   }
   now = get_time();
-  if (entry->until < now) {
-    if (strict)
-      entry->delta = desperation;
-    else
+  if ( (entry->strict == YES) &&
+       (strict == NO) ) {
+    /* stronger blacklisting in place! */
+    MUTEX_UNLOCK(lock_);
+    return OK;
+  }
+  if (strict) {
+      entry->delta = desperation * cronSECONDS;
+  } else {
+    if (entry->until < now) 
       entry->delta
        = weak_randomi(1+desperation*cronSECONDS);
-  } else {
-    if (strict)
-      entry->delta
-       += desperation;
     else
       entry->delta
        += weak_randomi(1+desperation*cronSECONDS);
@@ -882,7 +884,7 @@
           &hn);
 #if DEBUG_IDENTITY
   GE_LOG(ectx,
-        GE_INFO | GE_REQUEST | GE_USER,
+        GE_INFO | GE_REQUEST | GE_DEVELOPER,
         "Blacklisting host `%s' for %llu seconds"
         " until %llu (strict=%d).\n",
         &hn,
@@ -914,6 +916,19 @@
   now = get_time();
   if ( (now < entry->until) &&
        (entry->strict == YES) ) {
+#if DEBUG_IDENTITY
+    EncName enc;
+
+    IF_GELOG(ectx,
+            GE_INFO | GE_USER | GE_BULK,
+            hash2enc(&identity->hashPubKey,
+                     &enc));
+    GE_LOG(ectx,
+          GE_INFO | GE_USER | GE_BULK,
+          _("Peer `%s' is currently strictly blacklisted (for another 
%llums).\n"),
+          &enc,
+          entry->until - now);
+#endif
     MUTEX_UNLOCK(lock_);
     return YES;
   } else {
@@ -931,9 +946,6 @@
 static int whitelistHost(const PeerIdentity * identity) {
   HostEntry * entry;
   int i;
-#if DEBUG_IDENTITY
-  EncName enc;
-#endif
 
   GE_ASSERT(ectx, numberOfHosts_ <= sizeOfHosts_);
   MUTEX_LOCK(lock_);
@@ -952,15 +964,6 @@
     MUTEX_UNLOCK(lock_);
     return SYSERR;
   }
-#if DEBUG_IDENTITY
-  IF_GELOG(ectx, GE_INFO | GE_REQUEST | GE_USER,
-       hash2enc(&identity->hashPubKey,
-                &enc));
-  GE_LOG(ectx,
-        GE_INFO | GE_USER | GE_REQUEST,
-        "Whitelisting host `%s'\n",
-        &enc);
-#endif
   entry->delta = 30 * cronSECONDS;
   entry->until = 0;
   entry->strict = NO;
@@ -1026,6 +1029,22 @@
            break;
        }
       }
+    } else {
+#if DEBUG_IDENTITY
+      EncName enc;
+      
+      IF_GELOG(ectx,
+              GE_INFO | GE_USER | GE_BULK,
+              hash2enc(&entry->identity.hashPubKey,
+                       &enc));
+      GE_LOG(ectx,
+            GE_INFO | GE_USER | GE_BULK,
+            entry->strict ? 
+            _("Peer `%s' is currently strictly blacklisted (for another 
%llums).\n") :
+            _("Peer `%s' is currently blacklisted (for another %llums).\n"),
+            &enc,
+            entry->until - now);
+#endif
     }
     if (ret != OK)
       break;

Modified: GNUnet/src/applications/session/sessiontest.c
===================================================================
--- GNUnet/src/applications/session/sessiontest.c       2007-07-01 03:13:10 UTC 
(rev 5191)
+++ GNUnet/src/applications/session/sessiontest.c       2007-07-01 06:58:33 UTC 
(rev 5192)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2005, 2006 Christian Grothoff (and other contributing authors)
+     (C) 2005, 2006, 2007 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
@@ -32,7 +32,7 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_stats_lib.h"
 
-#define START_PEERS 1
+#define START_PEERS YES
 
 static int ok;
 
@@ -60,7 +60,8 @@
   struct DaemonContext * peers;
 #endif
   int ret;
-  struct ClientServerConnection * sock;
+  struct ClientServerConnection * sock1;
+  struct ClientServerConnection * sock2;
   int left;
   struct GC_Configuration * cfg;
 
@@ -87,11 +88,18 @@
   if (OK == connection_wait_for_running(NULL,
                                        cfg,
                                        30 * cronSECONDS)) {
-    sock = client_connection_create(NULL,
-                                   cfg);
+    sock1 = client_connection_create(NULL,
+                                    cfg);
+    GC_set_configuration_value_string(cfg,
+                                     NULL,
+                                     "NETWORK",
+                                     "HOST",
+                                     "localhost:12087");
+    sock2 = client_connection_create(NULL,
+                                    cfg);
     left = 30; /* how many iterations should we wait? */
     while (OK == STATS_getStatistics(NULL,
-                                    sock,
+                                    sock1,
                                     &waitForConnect,
                                     NULL)) {
       printf("Waiting for peers to connect (%u iterations left)...\n",
@@ -103,7 +111,40 @@
        break;
       }
     }
-    connection_destroy(sock);
+#if 0
+    if (ok == 1) {
+      for (left=0;left<10;left++) {
+       ok = 0;
+       while (GNUNET_SHUTDOWN_TEST() == NO) {
+         printf("Checking that peers are staying connected 1...\n");
+         STATS_getStatistics(NULL,
+                             sock1,
+                             &waitForConnect,
+                             NULL);
+         sleep(1);
+         if (ok == 0) {
+           printf("Peers disconnected!\n");
+           break;
+         }
+         printf("Checking that peers are staying connected 2...\n");
+         STATS_getStatistics(NULL,
+                             sock2,
+                             &waitForConnect,
+                             NULL);
+         sleep(1);
+         if (ok == 0) {
+           printf("Peers disconnected!\n");
+           break;
+         }
+       }       
+      }
+    } else {
+      printf("Peers failed to connect!\n");
+    }
+#endif
+
+    connection_destroy(sock1);
+    connection_destroy(sock2);
   } else {
     printf("Could not establish connection with peer.\n");
     ret = 1;

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-07-01 03:13:10 UTC 
(rev 5191)
+++ GNUnet/src/applications/topology_default/topology.c 2007-07-01 06:58:33 UTC 
(rev 5192)
@@ -41,6 +41,8 @@
 
 #define DEBUG_TOPOLOGY NO
 
+#define DEBUG_LIVENESS NO
+
 /**
  * After 2 minutes on an inactive connection, probe the other
  * node with a ping if we have achieved less than 50% of our
@@ -206,6 +208,11 @@
     GE_BREAK(NULL, 0); /* should REALLY not happen */
     return;
   }
+  if (OK == coreAPI->queryPeerStatus(&indexMatch.match, NULL, NULL)) {
+    GE_BREAK(NULL, 0); /* should REALLY not happen */
+    return;
+  }
+
 #if DEBUG_TOPOLOGY
   IF_GELOG(coreAPI->ectx,
           GE_DEBUG | GE_REQUEST | GE_USER | GE_DEVELOPER,
@@ -216,13 +223,15 @@
         "Trying to connect to peer `%s'\n",
         &enc);
 #endif
-  coreAPI->unicast(&indexMatch.match,
-                  NULL,
-                  0,
-                  0);
-  identity->blacklistHost(&indexMatch.match,
-                         (unsigned int) (saturation * 5 * 60 * 60), /* 5 hours 
at full saturation */
-                         NO);
+  if (NO == identity->isBlacklistedStrict(&indexMatch.match)) {
+    coreAPI->unicast(&indexMatch.match,
+                    NULL,
+                    0,
+                    0);
+    identity->blacklistHost(&indexMatch.match,
+                           (unsigned int) (saturation * 5 * 60 * 60), /* 5 
hours at full saturation */
+                           NO);
+  }
 }
 
 /**
@@ -232,6 +241,19 @@
  */
 static void notifyPONG(void * cls) {
   PeerIdentity * hostId = cls;
+#if DEBUG_TOPOLOGY || DEBUG_LIVENESS
+  EncName enc;
+  
+  IF_GELOG(coreAPI->ectx,
+          GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+          hash2enc(&hostId->hashPubKey,
+                   &enc));
+  GE_LOG(coreAPI->ectx,
+        GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+        "Received liveness confirmation from `%s'.\n",
+        &enc);
+#endif
+
   coreAPI->confirmSessionUp(hostId);
   FREE(hostId);
 }
@@ -244,8 +266,10 @@
   cron_t now;
   cron_t act;
   PeerIdentity * hi;
+  int ran;
 
-  if (weak_randomi(LIVE_PING_EFFECTIVENESS) != 0)
+  ran = weak_randomi(LIVE_PING_EFFECTIVENESS);
+  if (ran != 0)
     return;
   now = get_time();
   if (SYSERR == coreAPI->getLastActivityOf(peer, &act)) {
@@ -257,6 +281,21 @@
     /* if we have less than 75% of the number of connections
        that we would like to have, try ping-ing the other side
        to keep the connection open instead of hanging up */
+#if DEBUG_TOPOLOGY || DEBUG_LIVENESS
+    EncName enc;
+    
+    IF_GELOG(coreAPI->ectx,
+            GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+            hash2enc(&peer->hashPubKey,
+                     &enc));
+    GE_LOG(coreAPI->ectx,
+          GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+          "Peer `%s' was inactive for %llus.  Sending PING.\n",
+          &enc,
+          (now-act)/cronSECONDS);
+#endif
+
+
     hi = MALLOC(sizeof(PeerIdentity));
     *hi = *peer;
     if (OK != pingpong->ping(peer,

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-07-01 03:13:10 UTC (rev 5191)
+++ GNUnet/src/server/connection.c      2007-07-01 06:58:33 UTC (rev 5192)
@@ -631,39 +631,6 @@
 
 /* ******************** CODE ********************* */
 
-#if DEBUG_CONNECTION
-static void printMsg(const char *prefix,
-                    const PeerIdentity * sender,
-                     const SESSIONKEY * key,
-                    const INITVECTOR * iv,
-                    int crc) {
-  char skey[65];
-  char *dst;
-  int idx;
-  EncName enc;
-
-  hash2enc(&sender->hashPubKey,
-          &enc);
-  dst = skey;
-  for(idx = 0; idx < SESSIONKEY_LEN; idx++) {
-    sprintf(dst,
-           "%02x",
-           key->key[idx]);
-    dst += 2;
-  }
-  *dst = 0;
-
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "%s: Sender `%s', key `%s', IV %u msg CRC %u\n",
-        prefix,
-        &enc,
-        skey,
-        *((const int *) iv),
-        crc);
-}
-#endif
-
 /**
  * This allocates and initializes a BufferEntry.
  * @return the initialized BufferEntry
@@ -1034,13 +1001,6 @@
        if (entry->transmissionTime < deadline)
          deadline = entry->transmissionTime;
         (*priority) += entry->pri;
-#if DEBUG_CONNECTION
-        GE_LOG(ectx,
-              GE_DEBUG | GE_REQUEST | GE_USER,
-              "Selecting msg %u with length %u\n",
-              i,
-              entry->len);
-#endif
         totalMessageSize += entry->len;
       } else {
         entry->knapsackSolution = NO;
@@ -1062,11 +1022,6 @@
         entry->knapsackSolution = YES;
        if (entry->transmissionTime < deadline)
          deadline = entry->transmissionTime;   
-#if DEBUG_CONNECTION
-        GE_LOG(ectx,
-              GE_DEBUG | GE_REQUEST | GE_USER,
-              "Selecting msg %u with length %u\n", i, entry->len);
-#endif
         totalMessageSize += entry->len;
         (*priority) += entry->pri;
       } else {
@@ -1198,12 +1153,6 @@
   /* if it's more than one connection "lifetime" old, always kill it! */
   be->lastSendAttempt = get_time();
   expired = be->lastSendAttempt - SECONDS_PINGATTEMPT * cronSECONDS;
-#if DEBUG_CONNECTION
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "policy prevents sending message\n");
-#endif
-
   load = os_cpu_get_load(ectx, cfg);
   if (load < 0)
     load = 50; /* failed to determine load, assume 50% */
@@ -1524,35 +1473,15 @@
   if ( (OK != ensureTransportConnected(be)) ||
        (OK != checkSendFrequency(be)) ){
     be->inSendBuffer = NO;
-#if 0
-    GE_LOG(ectx,
-          GE_DEBUG | GE_DEVELOPER | GE_BULK,
-          "Will not try to send: %d %d\n",
-          (OK != ensureTransportConnected(be)),
-          (OK != checkSendFrequency(be)));
-#endif
     return NO;
   }
 
   /* test if receiver has enough bandwidth available!  */
   updateCurBPS(be);
-#if DEBUG_CONNECTION
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "receiver window available: %lld bytes (MTU: %u)\n",
-        be->available_send_window,
-        be->session.mtu);
-#endif
   totalMessageSize = selectMessagesToSend(be, &priority);
   if (totalMessageSize == 0) {
     expireSendBufferEntries(be);
     be->inSendBuffer = NO;
-#if DEBUG_CONNECTION
-    GE_LOG(ectx,
-          GE_DEBUG | GE_DEVELOPER | GE_BULK,
-          "No messages selected for sending (%d)\n",
-          be->available_send_window);
-#endif
     return NO;  /* deferr further */
   }
   GE_ASSERT(ectx,
@@ -1591,11 +1520,6 @@
      fails, return (but clean up garbage) */
   if ( (SYSERR == outgoingCheck(priority)) ||
        (0 == prepareSelectedMessages(be)) ) {
-#if DEBUG_CONNECTION
-    GE_LOG(ectx,
-          GE_DEBUG | GE_DEVELOPER | GE_BULK,
-          "Insufficient bandwidth or priority to send message\n");
-#endif
     expireSendBufferEntries(be);
     be->inSendBuffer = NO;
     return NO;             /* deferr further */
@@ -1626,13 +1550,6 @@
              (entry->knapsackSolution == YES) &&
              (entry->callback == NULL) &&
              (p + entry->len <= totalMessageSize));
-#if DEBUG_CONNECTION
-    GE_LOG(ectx,
-          GE_DEBUG | GE_REQUEST | GE_USER,
-          "Queuing msg %u with length %u\n",
-          i,
-          entry->len);
-#endif
     memcpy(&plaintextMsg[p],
           entry->closure,
           entry->len);
@@ -1713,24 +1630,10 @@
                     &be->skey_local,
                     (const INITVECTOR *) encryptedMsg,  /* IV */
                      &((P2P_PACKET_HEADER *) encryptedMsg)->sequenceNumber);
-#if DEBUG_CONNECTION
-  printMsg("Encrypting P2P data",
-          &be->session.sender,
-           &be->skey_local,
-          (const INITVECTOR *) encryptedMsg,
-           crc32N(&((P2P_PACKET_HEADER *) encryptedMsg)->sequenceNumber,
-                  ret));
-#endif
   if(stats != NULL)
     stats->change(stat_encrypted,
                  p - sizeof(HashCode512));
   GE_ASSERT(ectx, be->session.tsession != NULL);
-#if DEBUG_CONNECTION
-  GE_LOG(ectx,
-        GE_DEBUG | GE_DEVELOPER | GE_BULK,
-        "Asking transport to send message with priority %u\n",
-        priority);
-#endif
   ret = transport->send(be->session.tsession,
                        encryptedMsg,
                        p,
@@ -1819,22 +1722,15 @@
     return;
   }
 
-#if DEBUG_CONNECTION
-  IF_GELOG(ectx,
-          GE_DEBUG | GE_REQUEST | GE_USER,
-          hash2enc(&be->session.sender.hashPubKey,
-                   &enc));
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "adding message of size %d to buffer of host `%s'\n",
-        se->len,
-        &enc);
-#endif
   if ( (be->sendBufferSize > 0) &&
        (be->status != STAT_UP) ) {
     /* as long as we do not have a confirmed
        connection, do NOT queue messages! */
 #if DEBUG_CONNECTION
+    IF_GELOG(ectx,
+            GE_DEBUG | GE_REQUEST | GE_USER,
+            hash2enc(&be->session.sender.hashPubKey,
+                     &enc));
     GE_LOG(ectx,
           GE_DEBUG | GE_REQUEST | GE_USER,
           "not connected to `%s', message dropped\n",
@@ -1860,13 +1756,6 @@
     if (queueSize >= MAX_SEND_BUFFER_SIZE) {
       /* we need to enforce some hard limit here, otherwise we may take
          FAR too much memory (200 MB easily) */
-#if DEBUG_CONNECTION
-      GE_LOG(ectx,
-            GE_DEBUG | GE_REQUEST | GE_USER,
-            "queueSize (%llu) >= %d, refusing to queue message.\n",
-            queueSize,
-            MAX_SEND_BUFFER_SIZE);
-#endif
       FREE(se->closure);
       FREE(se);
       return;
@@ -1931,19 +1820,7 @@
   BufferEntry *root;
   BufferEntry *prev;
   unsigned int index;
-#if DEBUG_CONNECTION
-  EncName enc;
 
-  GE_IFLOG(ectx,
-          GE_DEBUG,
-          hash2enc(&hostId->hashPubKey,
-                   &enc));
-  GE_LOG(ectx,
-        GE_DEBUG,
-        "Adding host `%s' to the connection table.\n",
-        &enc);
-#endif
-
   ENTRY();
   root = lookForHost(hostId);
   index = computeIndex(hostId);
@@ -2153,7 +2030,9 @@
   int earlyRun;
   int load;
   int * perm;
+#if DEBUG_CONNECTION
   EncName enc;
+#endif
 
   MUTEX_LOCK(lock);
   now = get_time();
@@ -2264,17 +2143,19 @@
       entries[u]->violations++;
       entries[u]->recently_received = 0;  /* "clear" slate */
       if (entries[u]->violations > 10) {
+#if DEBUG_CONNECTION
         IF_GELOG(ectx,
-                GE_INFO | GE_BULK | GE_USER,
+                GE_INFO | GE_BULK | GE_DEVELOPER,
                 hash2enc(&entries[u]->session.sender.hashPubKey,
                          &enc));
         GE_LOG(ectx,
-              GE_INFO | GE_BULK | GE_USER,
+              GE_INFO | GE_BULK | GE_DEVELOPER,
               "blacklisting `%s': sent repeatedly %llu bpm "
               "(limit %u bpm, target %u bpm)\n",
               &enc,
               adjustedRR[u],
               entries[u]->max_transmitted_limit, entries[u]->idealized_limit);
+#endif
         identity->blacklistHost(&entries[u]->session.sender,
                                 24 * 60 * 60, /* 1 day */
                                YES);
@@ -2440,11 +2321,6 @@
           &enc,
           entries[u]->idealized_limit);
 #endif
-#if 0
-    printf("New inbound limit for peer #%u set to %u bpm\n",
-          u,
-          entries[u]->idealized_limit);
-#endif
     if ( (timeDifference > 50) &&
         (weak_randomi(timeDifference + 1) > 50) )
       entries[u]->current_connection_value *= 0.9; /* age */
@@ -2468,11 +2344,11 @@
     if (be->idealized_limit < MIN_BPM_PER_PEER) {
 #if DEBUG_CONNECTION
       IF_GELOG(ectx,
-              GE_DEBUG | GE_REQUEST | GE_USER,
+              GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
               hash2enc(&be->session.sender.hashPubKey,
                        &enc));
       GE_LOG(ectx,
-            GE_DEBUG | GE_REQUEST | GE_USER,
+            GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
             "Number of connections too high, shutting down low-traffic 
connection to `%s' (had only %u bpm)\n",
             &enc,
             be->idealized_limit);
@@ -2567,12 +2443,12 @@
 
           /* switch state form UP to DOWN: too much inactivity */
           IF_GELOG(ectx,
-                  GE_DEBUG | GE_REQUEST | GE_USER,
+                  GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
                   hash2enc(&root->session.sender.hashPubKey,
                            &enc));
           GE_LOG(ectx,
-                GE_DEBUG | GE_REQUEST | GE_USER,
-                "closing connection with `%s': "
+                GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+                "Closing connection with `%s': "
                 "too much inactivity (%llu ms)\n",
                 &enc,
                 now - root->isAlive);
@@ -2580,9 +2456,10 @@
          /* this was a valuable peer except for the timeout,
             let's keep it as a possibility for the near
             future! */
-         identity->whitelistHost(&root->session.sender);
+         identity->blacklistHost(&root->session.sender,
+                                 SECONDS_BLACKLIST_AFTER_DISCONNECT,
+                                 YES);
           shutdownConnection(root);
-
         }
         if ( (root->available_send_window > 35 * 1024) &&
             (root->sendBufferSize < 4) &&
@@ -2631,11 +2508,11 @@
           EncName enc;
 
           IF_GELOG(ectx,
-                  GE_DEBUG | GE_REQUEST | GE_USER,
+                  GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
                   hash2enc(&root->session.sender.hashPubKey,
                            &enc));
           GE_LOG(ectx,
-                GE_DEBUG | GE_REQUEST | GE_USER,
+                GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
                 "closing connection to %s: %s not answered.\n",
                 &enc,
                 (root->status == STAT_SETKEY_SENT) ? "SETKEY" : "PING");
@@ -2713,12 +2590,6 @@
   if (stats != NULL)
     stats->change(stat_received, size);
 
-#if DEBUG_CONNECTION
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "Decrypting message from host `%s'\n",
-        &enc);
-#endif
   MUTEX_LOCK(lock);
   be = lookForHost(sender);
   if((be == NULL) ||
@@ -2748,11 +2619,6 @@
           GE_INFO | GE_BULK | GE_DEVELOPER,
           "Decrypting message from host `%s' failed, wrong sessionkey!\n",
           &enc);
-#if DEBUG_CONNECTION
-    printMsg("Wrong sessionkey", sender,
-             &be->skey_remote, (const INITVECTOR *) &msg->hash,
-             crc32N(&msg->sequenceNumber, size - sizeof(HashCode512)));
-#endif
     addHost(sender, YES);
     MUTEX_UNLOCK(lock);
     FREE(tmp);
@@ -2801,12 +2667,6 @@
   }
 
   be->max_bpm = ntohl(msg->bandwidth);
-#if DEBUG_CONNECTION
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "Received bandwidth cap of %u bpm\n",
-        be->max_bpm);
-#endif
   if (be->available_send_window > (long long) be->max_bpm * MAX_BUF_FACT) {
     if (stats != NULL)
       stats->change(stat_total_lost_sent,
@@ -2844,11 +2704,11 @@
     return SYSERR;
 #if DEBUG_CONNECTION
   IF_GELOG(ectx,
-          GE_DEBUG | GE_REQUEST | GE_USER,
+          GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
           hash2enc(&sender->hashPubKey,
                    &enc));
   GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
+        GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
         "received HANGUP from `%s'\n",
         &enc);
 #endif
@@ -2928,6 +2788,17 @@
        ((be->status & STAT_SETKEY_RECEIVED) > 0) &&
        (OK == ensureTransportConnected(be)) &&
        (be->status != STAT_UP) ) {
+#if DEBUG_CONNECTION
+      EncName enc;
+      IF_GELOG(ectx,
+              GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+              hash2enc(&peer->hashPubKey,
+                       &enc));
+      GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+            "Received confirmation that session is UP for `%s'\n",
+            &enc);
+#endif
       be->status = STAT_UP;
       be->lastSequenceNumberReceived = 0;
       be->lastSequenceNumberSend = 1;
@@ -2973,7 +2844,8 @@
  * @param time updated with the time
  * @return SYSERR if we are not connected to the peer at the moment
  */
-int getLastActivityOf(const PeerIdentity * peer, cron_t * time) {
+int getLastActivityOf(const PeerIdentity * peer, 
+                     cron_t * time) {
   int ret;
   BufferEntry *be;
 
@@ -2983,8 +2855,7 @@
   if((be != NULL) && (be->status == STAT_UP)) {
     *time = be->isAlive;
     ret = OK;
-  }
-  else {
+  } else {
     *time = 0;
     ret = SYSERR;
   }
@@ -3226,7 +3097,7 @@
               CDL_FREQUENCY,
               CDL_FREQUENCY,
               NULL);
-#if DEBUG_COLLECT_PRIO == YES
+#if DEBUG_COLLECT_PRIO
   prioFile = FOPEN("/tmp/knapsack_prio.txt", "w");
 #endif
 
@@ -3341,7 +3212,10 @@
   releaseService(stats);
   stats = NULL;
 #if DEBUG_COLLECT_PRIO == YES
-  fclose(prioFile);
+  if (prioFile != NULL) {
+    fclose(prioFile);
+    prioFile = NULL;
+  }
 #endif
   ectx = NULL;
   cfg = NULL;
@@ -3562,20 +3436,7 @@
                      unsigned int importance,
                     unsigned int maxdelay) {
   BufferEntry *be;
-#if DEBUG_CONNECTION
-  EncName enc;
 
-  IF_GELOG(ectx,
-          GE_DEBUG | GE_REQUEST | GE_USER,
-          hash2enc(&hostId->hashPubKey,
-                   &enc));
-  GE_LOG(ectx,
-        GE_DEBUG | GE_REQUEST | GE_USER,
-        "%s: sending message to host %s message of size %d\n",
-        __FUNCTION__,
-        &enc,
-        len);
-#endif
   ENTRY();
   MUTEX_LOCK(lock);
   be = addHost(hostId, YES);
@@ -3737,11 +3598,11 @@
     EncName enc;
 
     IF_GELOG(ectx,
-            GE_DEBUG | GE_REQUEST | GE_USER,
+            GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
             hash2enc(&node->hashPubKey,
                      &enc));
     GE_LOG(ectx,
-          GE_DEBUG | GE_REQUEST | GE_USER,
+          GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
           "Closing connection to `%s' as requested by application.\n",
           &enc);
 #endif

Modified: GNUnet/src/server/handler.c
===================================================================
--- GNUnet/src/server/handler.c 2007-07-01 03:13:10 UTC (rev 5191)
+++ GNUnet/src/server/handler.c 2007-07-01 06:58:33 UTC (rev 5192)
@@ -515,8 +515,6 @@
                size - sizeof(P2P_PACKET_HEADER),
                ret,
                tsession);
-  if (sender != NULL)
-    confirmSessionUp(sender);
 }
 
 /**





reply via email to

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