gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1111 - in GNUnet/src/applications: identity session topolo


From: grothoff
Subject: [GNUnet-SVN] r1111 - in GNUnet/src/applications: identity session topology_default
Date: Tue, 28 Jun 2005 11:01:43 -0700 (PDT)

Author: grothoff
Date: 2005-06-28 11:01:38 -0700 (Tue, 28 Jun 2005)
New Revision: 1111

Modified:
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/topology_default/topology.c
Log:
debugging

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2005-06-28 17:50:19 UTC (rev 
1110)
+++ GNUnet/src/applications/identity/identity.c 2005-06-28 18:01:38 UTC (rev 
1111)
@@ -218,8 +218,8 @@
  * Increase the host credit by a value.
  *
  * @param hostId is the identity of the host
- * @param value is the int value by which the host credit is to be increased or
- *        decreased
+ * @param value is the int value by which the 
+ *  host credit is to be increased or decreased
  * @returns the actual change in trust (positive or negative)
  */
 static int changeHostTrust(const PeerIdentity * hostId,
@@ -238,9 +238,11 @@
   }
   if ( ((int) (host->trust & TRUST_ACTUAL_MASK)) + value < 0) {
     value = - (host->trust & TRUST_ACTUAL_MASK);
-    host->trust = 0 | TRUST_REFRESH_MASK; /* 0 remaining */
+    host->trust = 0 
+      | TRUST_REFRESH_MASK; /* 0 remaining */
   } else {
-    host->trust = ( (host->trust & TRUST_ACTUAL_MASK) + value) | 
TRUST_REFRESH_MASK;
+    host->trust = ( (host->trust & TRUST_ACTUAL_MASK) + value)
+      | TRUST_REFRESH_MASK;
   }
   MUTEX_UNLOCK(&lock_);
   return value;
@@ -294,7 +296,8 @@
   strcat(fullname, filename);
   if (0 == UNLINK(fullname))
     LOG(LOG_WARNING,
-       _("File '%s' in directory '%s' does not match naming convention. 
Removed.\n"),
+       _("File '%s' in directory '%s' does not match naming convention. "
+         "Removed.\n"),
        filename,
        networkIdDirectory);
   else
@@ -317,7 +320,7 @@
                        NULL);
   if (count <= 0) {
     retries++;
-    if (retries > 32) {
+    if ((retries & 32) > 0) {
       LOG(LOG_WARNING,
          _("%s '%s' returned no known hosts!\n"),
          "scanDirectory",
@@ -333,7 +336,9 @@
   HELO_Message * msg;
 
   msg = MALLOC(HELO_Message_size(tmp));
-  memcpy(msg, tmp, HELO_Message_size(tmp));
+  memcpy(msg,
+        tmp,
+        HELO_Message_size(tmp));
   MUTEX_LOCK(&lock_);
   FREENONNULL(tempHosts[tempHostsNextSlot]);
   tempHosts[tempHostsNextSlot++] = msg;
@@ -360,7 +365,9 @@
       /* now remove the file */
       fn = getHostFileName(identity, protocol);
       if (0 != UNLINK(fn))
-       LOG_FILE_STRERROR(LOG_WARNING, "unlink", fn);
+       LOG_FILE_STRERROR(LOG_WARNING, 
+                         "unlink",
+                         fn);
       FREE(fn);
       MUTEX_UNLOCK(&lock_);
       return; /* deleted */
@@ -456,7 +463,9 @@
              _("Removed file '%s' containing invalid peer advertisement.\n"),
              fileName);
        else
-         LOG_FILE_STRERROR(LOG_ERROR, "unlink", fileName);
+         LOG_FILE_STRERROR(LOG_ERROR, 
+                           "unlink",
+                           fileName);
        FREE(tmp);
       } else {
        if (res->result == SYSERR) {
@@ -477,7 +486,9 @@
            _("Removed file '%s' containing invalid peer advertisement.\n"),
            fileName);
       } else {
-       LOG_FILE_STRERROR(LOG_ERROR, "unlink", fileName);
+       LOG_FILE_STRERROR(LOG_ERROR,
+                         "unlink",
+                         fileName);
       }
     }
     FREE(fileName);
@@ -523,7 +534,9 @@
            _("Removed file '%s' containing invalid HELO data.\n"),
            fn);
       else
-       LOG_FILE_STRERROR(LOG_ERROR, "unlink", fn);
+       LOG_FILE_STRERROR(LOG_ERROR, 
+                         "unlink",
+                         fn);
       FREE(fn);
       FREE(*result);
       *result = NULL;
@@ -537,7 +550,9 @@
          _("Removed invalid HELO file '%s'\n"),
          fn);
     else
-      LOG_FILE_STRERROR(LOG_ERROR, "unlink", fn);
+      LOG_FILE_STRERROR(LOG_ERROR,
+                       "unlink", 
+                       fn);
   }
   FREE(fn);
 
@@ -583,7 +598,8 @@
 
 
 /**
- * @param signer the identity of the host that presumably signed the message
+ * @param signer the identity of the host that
+ *        presumably signed the message
  * @param message the signed message
  * @param size the size of the message
  * @param sig the signature
@@ -649,7 +665,8 @@
               &hn);
 #if DEBUG_IDENTITY 
       LOG(LOG_INFO,
-         "Blacklisting host '%s' (%d) for %llu seconds until %llu 
(strict=%d).\n",
+         "Blacklisting host '%s' (%d) for %llu seconds"
+         " until %llu (strict=%d).\n",
          &hn,
          i,
          hosts_[i].delta / cronSECONDS,
@@ -704,6 +721,16 @@
   for (i=0;i<count_;i++) {
     if (hostIdentityEquals(identity,
                           &hosts_[i].identity)) {
+#if DEBUG_IDENTITY 
+      EncName enc;
+
+      IFLOG(LOG_INFO,
+           hash2enc(&identity->hashPubKey,
+                    &enc));
+      LOG(LOG_INFO,
+         "Whitelisting host '%s'\n",
+         &enc);
+#endif
       hosts_[i].delta = 30 * cronSECONDS;
       hosts_[i].until = 0;
       hosts_[i].strict = NO;
@@ -719,7 +746,8 @@
  * Call a method for each known host.
  *
  * @param callback the method to call for each host
- * @param now the time to use for excluding hosts due to blacklisting, use 0
+ * @param now the time to use for excluding hosts 
+ *        due to blacklisting, use 0
  *        to go through all hosts.
  * @param data an argument to pass to the method
  * @return the number of hosts matching
@@ -845,7 +873,8 @@
  * @param capi the core API
  * @return NULL on errors, ID_API otherwise
  */
-Identity_ServiceAPI * provide_module_identity(CoreAPIForApplication * capi) {
+Identity_ServiceAPI * 
+provide_module_identity(CoreAPIForApplication * capi) {
   static Identity_ServiceAPI id;
   char * gnHome;
   int i;
@@ -876,10 +905,11 @@
                  &myIdentity);
 
   MUTEX_CREATE_RECURSIVE(&lock_);
-  networkIdDirectory = getFileName("GNUNETD",
-                                  "HOSTS",
-                                  _("Configuration file must specify directory 
for "
-                                    "network identities in section %s under 
%s.\n"));
+  networkIdDirectory
+    = getFileName("GNUNETD",
+                 "HOSTS",
+                 _("Configuration file must specify directory for "
+                   "network identities in section %s under %s.\n"));
   mkdirp(networkIdDirectory);
   gnHome = getFileName("GNUNETD",
                       "GNUNETD_HOME",

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2005-06-28 17:50:19 UTC (rev 
1110)
+++ GNUnet/src/applications/session/connect.c   2005-06-28 18:01:38 UTC (rev 
1111)
@@ -23,9 +23,6 @@
  * @brief module responsible for the sessionkey exchange
  *   which establishes a session with another peer
  * @author Christian Grothoff
- *
- * Todo:
- * - add support for re-keying
  */
 
 #include "platform.h"
@@ -39,7 +36,7 @@
 
 #define HELO_HELPER_TABLE_START_SIZE 64
 
-#define DEBUG_SESSION NO
+#define DEBUG_SESSION YES
 
 static CoreAPIForApplication * coreAPI;
 
@@ -281,10 +278,11 @@
     FREE(limited);
   }
 
-  if (OK != identity->verifyPeerSignature(hostId,
-                                         sks,
-                                         sizeof(SKEY_Message) - 
sizeof(Signature),
-                                         &sks->signature)) {
+  if (OK != identity->verifyPeerSignature
+      (hostId,
+       sks,
+       sizeof(SKEY_Message) - sizeof(Signature),
+       &sks->signature)) {
     EncName enc;
 
     IFLOG(LOG_INFO,

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-06-28 17:50:19 UTC 
(rev 1110)
+++ GNUnet/src/applications/topology_default/topology.c 2005-06-28 18:01:38 UTC 
(rev 1111)
@@ -142,7 +142,8 @@
  * transport cost for the hosttable at index index. When called, the
  * mutex of at the given index must not be hold.
  *
- * @param index for which entry in the connection table are we looking for 
peers?
+ * @param index for which entry in the connection table
+ *   are we looking for peers?
  */
 static void scanForHosts(unsigned int index) {
   IndexMatch indexMatch;





reply via email to

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