removing dead code / unused variables
[oweals/gnunet.git] / src / core / core_api.c
index 10fa0ccdd22d52ad4e933e87b3c3117ddbf1de53..1e37c91c24b6e52d53b1eff97b835f58ae25837b 100644 (file)
@@ -427,9 +427,11 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       return;
     }
   msize = ntohs (msg->size);
+#if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Processing message of type %u and size %u from core service\n",
               ntohs (msg->type), msize);
+#endif
   switch (ntohs (msg->type))
     {
     case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT:
@@ -444,6 +446,8 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg)
           break;
         }
       cnm = (const struct ConnectNotifyMessage *) msg;
+      h->connects (h->cls,
+                  &cnm->peer);
       break;
     case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT:
       if (NULL == h->disconnects)
@@ -457,6 +461,8 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg)
           break;
         }
       cnm = (const struct ConnectNotifyMessage *) msg;
+      h->disconnects (h->cls,
+                     &cnm->peer);
       break;
     case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND:
       if (msize <
@@ -468,9 +474,11 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg)
         }
       ntm = (const struct NotifyTrafficMessage *) msg;
       em = (const struct GNUNET_MessageHeader *) &ntm[1];
+#if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Received message of type %u from peer `%4s'\n",
                   ntohs (em->type), GNUNET_i2s (&ntm->peer));
+#endif
       if ((GNUNET_NO == h->inbound_hdr_only) &&
           (msize != ntohs (em->size) + sizeof (struct NotifyTrafficMessage)))
         {
@@ -620,9 +628,11 @@ init_reply_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     }
   m = (const struct InitReplyMessage *) msg;
   /* start our message processing loop */
+#if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               _
               ("Successfully connected to core service, starting processing loop.\n"));
+#endif
   h->currently_down = GNUNET_NO;
   trigger_next_request (h);
   GNUNET_CLIENT_receive (h->client,
@@ -631,8 +641,10 @@ init_reply_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     {
       /* mark so we don't call init on reconnect */
       h->init = NULL;
+#if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                   _("Successfully connected to core service.\n"));
+#endif
       GNUNET_CRYPTO_hash (&m->publicKey,
                           sizeof (struct
                                   GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
@@ -732,8 +744,8 @@ transmit_start (void *cls, size_t size, void *buf)
   GNUNET_CLIENT_receive (h->client,
                          &init_reply_handler,
                          h,
-                         GNUNET_TIME_absolute_get_remaining (h->
-                                                             startup_timeout));
+                         GNUNET_TIME_absolute_get_remaining
+                         (h->startup_timeout));
   return sizeof (struct InitMessage) + h->hcnt * sizeof (uint16_t);
 }
 
@@ -800,9 +812,11 @@ GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched,
   GNUNET_assert (h->hcnt <
                  (GNUNET_SERVER_MAX_MESSAGE_SIZE -
                   sizeof (struct InitMessage)) / sizeof (uint16_t));
+#if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Trying to connect to core service in next %llu ms.\n",
               timeout.value);
+#endif
   h->th =
     GNUNET_CLIENT_notify_transmit_ready (h->client,
                                          sizeof (struct InitMessage) +
@@ -894,7 +908,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle,
                             struct GNUNET_TIME_Relative timeout,
                             unsigned int bpm_out,
                             int amount,
-                            double preference,
+                            unsigned long long preference,
                             GNUNET_CORE_PeerConfigurationInfoCallback info,
                             void *info_cls)
 {
@@ -928,7 +942,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle,
   rcm->reserved = htonl (0);
   rcm->limit_outbound_bpm = htonl (bpm_out);
   rcm->reserve_inbound = htonl (amount);
-  rcm->preference_change = preference;
+  rcm->preference_change = GNUNET_htonll(preference);
   rcm->peer = *peer;
   if (handle->pending_head == th)
     trigger_next_request (handle);