hxing typemap
[oweals/gnunet.git] / src / core / gnunet-service-core.c
index 944159b65125a3e100c3143975060d87d14c047f..34b35f92a122136f9cffcb2394398b5ba9a77a7d 100644 (file)
@@ -44,9 +44,9 @@
 #include "core.h"
 
 
-#define DEBUG_HANDSHAKE GNUNET_NO
+#define DEBUG_HANDSHAKE GNUNET_EXTRA_LOGGING
 
-#define DEBUG_CORE_QUOTA GNUNET_NO
+#define DEBUG_CORE_QUOTA GNUNET_EXTRA_LOGGING
 
 /**
  * Receive and send buffer windows grow over time.  For
@@ -1393,8 +1393,7 @@ handle_client_init (void *cls, struct GNUNET_SERVER_Client *client,
   irm.header.size = htons (sizeof (struct InitReplyMessage));
   irm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY);
   irm.reserved = htonl (0);
-  memcpy (&irm.publicKey, &my_public_key,
-          sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
+  irm.my_identity = my_identity;
 #if DEBUG_CORE_CLIENT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n",
               "INIT_REPLY");
@@ -2079,7 +2078,7 @@ process_encrypted_neighbour_queue (struct Neighbour *n)
               GNUNET_TIME_absolute_get_remaining (m->deadline).rel_value);
 #endif
   n->th =
-      GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size,
+       GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size,
                                               m->priority,
                                               GNUNET_TIME_absolute_get_remaining
                                               (m->deadline),
@@ -2969,52 +2968,6 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client,
 }
 
 
-/**
- * Handle CORE_REQUEST_CONNECT request.
- *
- * @param cls unused
- * @param client the client issuing the request
- * @param message the "struct ConnectMessage"
- */
-static void
-handle_client_request_connect (void *cls, struct GNUNET_SERVER_Client *client,
-                               const struct GNUNET_MessageHeader *message)
-{
-  const struct ConnectMessage *cm = (const struct ConnectMessage *) message;
-  struct Neighbour *n;
-
-  if (0 ==
-      memcmp (&cm->peer, &my_identity, sizeof (struct GNUNET_PeerIdentity)))
-  {
-    /* In this case a client has asked us to connect to ourselves, not really an error! */
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-    return;
-  }
-  GNUNET_break (ntohl (cm->reserved) == 0);
-#if DEBUG_CORE
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Core received `%s' request for `%4s', will try to establish connection\n",
-              "REQUEST_CONNECT", GNUNET_i2s (&cm->peer));
-#endif
-  GNUNET_STATISTICS_update (stats,
-                            gettext_noop ("# connection requests received"), 1,
-                            GNUNET_NO);
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  n = find_neighbour (&cm->peer);
-  if ((n == NULL) || (GNUNET_YES != n->is_connected))
-  {
-    GNUNET_TRANSPORT_try_connect (transport, &cm->peer);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (stats,
-                              gettext_noop
-                              ("# connection requests ignored (already connected)"),
-                              1, GNUNET_NO);
-  }
-}
-
-
 /**
  * PEERINFO is giving us a HELLO for a peer.  Add the public key to
  * the neighbour's struct and retry send_key.  Or, if we did not get a
@@ -3838,6 +3791,7 @@ send_p2p_message_to_client (struct Neighbour *sender, struct Client *client,
   struct GNUNET_TRANSPORT_ATS_Information *ats;
 
   GNUNET_assert (GNUNET_YES == sender->is_connected);
+  GNUNET_break (sender->status == PEER_STATE_KEY_CONFIRMED);
   if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
@@ -3888,6 +3842,7 @@ deliver_message (void *cls, void *client, const struct GNUNET_MessageHeader *m)
   int deliver_full;
   int dropped;
 
+  GNUNET_break (sender->status == PEER_STATE_KEY_CONFIRMED);
   type = ntohs (m->type);
 #if DEBUG_CORE > 1
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4585,9 +4540,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
      sizeof (struct SendMessageRequest)},
     {&handle_client_send, NULL,
      GNUNET_MESSAGE_TYPE_CORE_SEND, 0},
-    {&handle_client_request_connect, NULL,
-     GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT,
-     sizeof (struct ConnectMessage)},
     {NULL, NULL, 0, 0}
   };
   char *keyfile;
@@ -4650,14 +4602,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
                                 &handle_transport_notify_disconnect);
   GNUNET_assert (NULL != transport);
   stats = GNUNET_STATISTICS_create ("core", cfg);
-
-  GNUNET_STATISTICS_set (stats, gettext_noop ("# discarded CORE_SEND requests"),
-                         0, GNUNET_NO);
-  GNUNET_STATISTICS_set (stats,
-                         gettext_noop
-                         ("# discarded lower priority CORE_SEND requests"), 0,
-                         GNUNET_NO);
-
   mst = GNUNET_SERVER_mst_create (&deliver_message, NULL);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task,
                                 NULL);