fix
authorChristian Grothoff <christian@grothoff.org>
Tue, 11 Oct 2011 11:19:37 +0000 (11:19 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 11 Oct 2011 11:19:37 +0000 (11:19 +0000)
src/core/gnunet-service-core_clients.c
src/core/gnunet-service-core_kx.c
src/core/gnunet-service-core_sessions.c

index 2b1c5fe5977a9373c809ac599df037a7d43cdc4d..838fa42db9db47582b81798676e4488a47c2e546 100644 (file)
@@ -220,10 +220,10 @@ send_to_all_clients (const struct GNUNET_MessageHeader *msg,
            ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) &&
              (GNUNET_YES == type_match (type, c)) ) ) )
       continue; /* skip */
-#if DEBUG_CORE > 1
+#if DEBUG_CORE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "Sending message of type %u to client.\n",
-               (unsigned int) ntohs (msg->type));
+               "Sending message to all clients interested in messages of type %u.\n",
+               (unsigned int) type);
 #endif
     send_to_client (c, msg, can_drop);
   }
@@ -323,6 +323,11 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
   }
   if (c->requests == NULL)
     c->requests = GNUNET_CONTAINER_multihashmap_create (16);
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Client asked for transmission to `%s'\n",
+             GNUNET_i2s (&req->peer));
+#endif
   car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey);
   if (car == NULL)
   {
@@ -417,6 +422,13 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client,
                                                       &sm->peer.hashPubKey,
                                                       tc.car));
   tc.cork = ntohl (sm->cork);
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Client asked for transmission of %u bytes to `%s' %s\n",
+             msize,
+             GNUNET_i2s (&sm->peer),
+             tc.cork ? "now" : "");
+#endif
   GNUNET_SERVER_mst_receive (client_mst,
                             &tc, 
                             (const char*) &sm[1], msize,
@@ -450,6 +462,11 @@ client_tokenizer_callback (void *cls, void *client,
   if (0 ==
       memcmp (&car->target, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity)))  
   {
+#if DEBUG_CORE
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Delivering message of type %u to myself\n",
+               ntohs (message->type));
+#endif
     GSC_CLIENTS_deliver_message (&GSC_my_identity, 
                                 NULL, 0,
                                 message,
@@ -462,7 +479,15 @@ client_tokenizer_callback (void *cls, void *client,
                                 GNUNET_CORE_OPTION_SEND_HDR_INBOUND | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);  
   }
   else
+  {
+#if DEBUG_CORE
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Delivering message of type %u to %s\n",
+               ntohs (message->type),
+               GNUNET_i2s (&car->target));
+#endif
     GSC_SESSIONS_transmit (car, message, tc->cork);
+  }
 }
 
 
index 19b692ab945581c4d54760ea4464011064f04e2e..4b9a9498b81c27a03492e6a3259bfdd247de4f5a 100644 (file)
@@ -654,6 +654,11 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
 {
   struct GSC_KeyExchangeInfo *kx;
 
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Initiating key exchange with `%s'\n",
+             GNUNET_i2s (pid));
+#endif
   kx = GNUNET_malloc (sizeof (struct GSC_KeyExchangeInfo));
   kx->peer = *pid;
   kx->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY;
@@ -782,6 +787,11 @@ GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx,
   GNUNET_STATISTICS_update (GSC_stats,
                             gettext_noop ("# SET_KEY messages decrypted"), 1,
                             GNUNET_NO);
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Received SET_KEY from `%s'\n",
+             GNUNET_i2s (&kx->peer));
+#endif
   kx->decrypt_key = k;
   if (kx->decrypt_key_created.abs_value != t.abs_value)
   {
@@ -895,6 +905,11 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx,
     GNUNET_break_op (0);
     return;
   }
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Received PING from `%s'\n",
+             GNUNET_i2s (&kx->peer));
+#endif
   /* construct PONG */
   tx.reserved = GNUNET_BANDWIDTH_VALUE_MAX;
   tx.challenge = t.challenge;
@@ -999,6 +1014,11 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     kx->status = KX_STATE_DOWN;
     return;
   }
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Sending KEEPALIVE to `%s'\n",
+             GNUNET_i2s (&kx->peer));
+#endif
   setup_fresh_ping (kx);
   GSC_NEIGHBOURS_transmit (&kx->peer,
                           &kx->ping.header,
@@ -1053,7 +1073,6 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH
   }
   GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# PONG messages received"),
                            1, GNUNET_NO);
-
   if ( (kx->status != KX_STATE_KEY_RECEIVED) &&
        (kx->status != KX_STATE_UP) )
   {
@@ -1099,6 +1118,11 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH
 #endif
     return;
   }
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Received PONG from `%s'\n",
+             GNUNET_i2s (&kx->peer));
+#endif
   switch (kx->status)
   {
   case KX_STATE_DOWN:
@@ -1144,6 +1168,11 @@ send_key (struct GSC_KeyExchangeInfo *kx)
   if (kx->public_key == NULL)
   {
     /* lookup public key, then try again */
+#if DEBUG_CORE
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Trying to obtain public key for `%s'\n",
+               GNUNET_i2s (&kx->peer));
+#endif
     kx->pitr =
       GNUNET_PEERINFO_iterate (peerinfo, &kx->peer,
                               GNUNET_TIME_UNIT_FOREVER_REL /* timeout? */,
@@ -1178,7 +1207,11 @@ send_key (struct GSC_KeyExchangeInfo *kx)
 
   /* always update sender status in SET KEY message */
   kx->skm.sender_status = htonl ((int32_t) kx->status);
-
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Sending SET_KEY and PING to `%s'\n",
+             GNUNET_i2s (&kx->peer));
+#endif
   GSC_NEIGHBOURS_transmit (&kx->peer,
                           &kx->skm.header,
                           kx->set_key_retry_frequency);
@@ -1228,6 +1261,12 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
   GNUNET_assert (GNUNET_OK ==
                  do_encrypt (kx, &iv, &ph->sequence_number, &em->sequence_number,
                              used - ENCRYPTED_HEADER_SIZE));
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Encrypted %u bytes for %s\n",
+             used - ENCRYPTED_HEADER_SIZE,
+             GNUNET_i2s (&kx->peer));
+#endif
   derive_auth_key (&auth_key, &kx->encrypt_key, ph->iv_seed,
                    kx->encrypt_key_created);
   GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number,
@@ -1320,6 +1359,12 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
       do_decrypt (kx, &iv, &m->sequence_number, &buf[ENCRYPTED_HEADER_SIZE],
                   size - ENCRYPTED_HEADER_SIZE))
     return;
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Decrypted %u bytes from %s\n",
+             size - ENCRYPTED_HEADER_SIZE,
+             GNUNET_i2s (&kx->peer));
+#endif
   pt = (struct EncryptedMessage *) buf;
 
   /* validate sequence number */
index 4808576423a7398523222832b404f26eabe4e355..360b558e4f35da92f6c4651aca072ed0892704e2 100644 (file)
@@ -421,7 +421,7 @@ static void
 pop_cork_task (void *cls,
               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  struct Session *session = session;
+  struct Session *session = cls;
 
   session->cork_task = GNUNET_SCHEDULER_NO_TASK;
   try_transmission (session);