-adding some rudimentary logging
[oweals/gnunet.git] / src / topology / gnunet-daemon-topology.c
index 55ee36fd2fe1b9e06091466c7bd7195c618893cd..38a648afc03bce3d24f19f91857e42d951375427 100644 (file)
@@ -88,12 +88,6 @@ struct Peer
    */
   struct GNUNET_CORE_TransmitHandle *hello_req;
 
-  /**
-   * Our handle for the request to connect to this peer; NULL if no
-   * such request is pending.
-   */
-  struct GNUNET_CORE_PeerRequestHandle *connect_req;
-
   /**
    * Pointer to the HELLO message of this peer; can be NULL.
    */
@@ -268,21 +262,6 @@ whitelist_peers ()
 }
 
 
-/**
- * Function called by core when our request to connect was transmitted.
- *
- * @param cls the 'struct Peer' for which we issued the connect request
- * @param success was the request transmitted
- */
-static void
-connect_completed_callback (void *cls, int success)
-{
-  struct Peer *pos = cls;
-
-  pos->connect_req = NULL;
-}
-
-
 /**
  * Check if an additional connection from the given peer is allowed.
  *
@@ -334,8 +313,6 @@ free_peer (void *cls, const GNUNET_HashCode * pid, void *value)
                 GNUNET_CONTAINER_multihashmap_remove (peers, pid, pos));
   if (pos->hello_req != NULL)
     GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req);
-  if (pos->connect_req != NULL)
-    GNUNET_CORE_peer_request_connect_cancel (pos->connect_req);
   if (pos->hello_delay_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
   if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK)
@@ -399,11 +376,10 @@ attempt_connect (struct Peer *pos)
               GNUNET_i2s (&pos->pid));
 #endif
   GNUNET_STATISTICS_update (stats,
-                            gettext_noop ("# connect requests issued to core"),
-                            1, GNUNET_NO);
-  pos->connect_req =
-      GNUNET_CORE_peer_request_connect (handle, &pos->pid,
-                                        &connect_completed_callback, pos);
+                            gettext_noop
+                            ("# connect requests issued to transport"), 1,
+                            GNUNET_NO);
+  GNUNET_TRANSPORT_try_connect (transport, &pos->pid);
 }
 
 
@@ -657,10 +633,12 @@ reschedule_hellos (void *cls, const GNUNET_HashCode * pid, void *value)
  * @param cls closure
  * @param peer peer identity this notification is about
  * @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
  */
 static void
 connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+                const struct GNUNET_ATS_Information *atsi,
+                unsigned int atsi_count)
 {
   struct Peer *pos;
 
@@ -796,16 +774,13 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
  * Iterator called on each address.
  *
  * @param cls flag that we will set if we see any addresses
- * @param tname name of the transport
+ * @param address the address of the peer
  * @param expiration when will the given address expire
- * @param addr the address of the peer
- * @param addrlen number of bytes in addr
  * @return GNUNET_SYSERR always, to terminate iteration
  */
 static int
-address_iterator (void *cls, const char *tname,
-                  struct GNUNET_TIME_Absolute expiration, const void *addr,
-                  uint16_t addrlen)
+address_iterator (void *cls, const struct GNUNET_HELLO_Address *address,
+                  struct GNUNET_TIME_Absolute expiration)
 {
   int *flag = cls;
 
@@ -963,12 +938,10 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
  * @param cls closure
  * @param server handle to the server, NULL if we failed
  * @param my_id ID of this peer, NULL if we failed
- * @param publicKey public key of this peer, NULL if we failed
  */
 static void
 core_init (void *cls, struct GNUNET_CORE_Handle *server,
-           const struct GNUNET_PeerIdentity *my_id,
-           const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
+           const struct GNUNET_PeerIdentity *my_id)
 {
   if (server == NULL)
   {
@@ -1127,13 +1100,15 @@ read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg)
  *        for loopback messages where we are both sender and receiver)
  * @param message the actual HELLO message
  * @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
  * @return GNUNET_OK to keep the connection open,
  *         GNUNET_SYSERR to close it (signal serious error)
  */
 static int
 handle_encrypted_hello (void *cls, const struct GNUNET_PeerIdentity *other,
                         const struct GNUNET_MessageHeader *message,
-                        const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+                        const struct GNUNET_ATS_Information *atsi,
+                        unsigned int atsi_count)
 {
   struct Peer *peer;
   struct GNUNET_PeerIdentity pid;
@@ -1305,8 +1280,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
   handle =
       GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_notify,
-                           &disconnect_notify, NULL, NULL, GNUNET_NO, NULL,
-                           GNUNET_NO, handlers);
+                           &disconnect_notify, NULL, GNUNET_NO, NULL, GNUNET_NO,
+                           handlers);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task,
                                 NULL);
   if (NULL == transport)