gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10284 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r10284 - gnunet/src/transport
Date: Sat, 13 Feb 2010 12:30:08 +0100

Author: grothoff
Date: 2010-02-13 12:30:08 +0100 (Sat, 13 Feb 2010)
New Revision: 10284

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/transport.h
Log:
fixing types and comment styles and struct alignments

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-02-12 10:33:19 UTC 
(rev 10283)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-02-13 11:30:08 UTC 
(rev 10284)
@@ -79,7 +79,10 @@
  */
 #define TRANSPORT_DEFAULT_TIMEOUT GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 15)
 
-#define TRANSPORT_DEFAULT_PRIORITY 4 /* Tired of remembering arbitrary 
priority names */
+/**
+ * FIXME: document!
+ */
+#define TRANSPORT_DEFAULT_PRIORITY 4
 
 /**
  * How often do we re-add (cheaper) plugins to our list of plugins
@@ -143,14 +146,6 @@
   char *addr;
 
   /**
-   * Is this plugin ready to transmit to the specific target?
-   * GNUNET_NO if not.  Initially, all plugins are marked ready.  If a
-   * transmission is in progress, "transmit_ready" is set to
-   * GNUNET_NO.
-   */
-  int transmit_ready;
-
-  /**
    * What was the last latency observed for this plugin
    * and peer?  Invalid if connected is GNUNET_NO.
    */
@@ -180,6 +175,14 @@
   int connected;
 
   /**
+   * Is this plugin ready to transmit to the specific target?
+   * GNUNET_NO if not.  Initially, all plugins are marked ready.  If a
+   * transmission is in progress, "transmit_ready" is set to
+   * GNUNET_NO.
+   */
+  int transmit_ready;
+
+  /**
    * How often have we tried to connect using this plugin?
    */
   unsigned int connect_attempts;
@@ -269,6 +272,7 @@
    * to the list and wait for the commit call.
    */
   int rebuild;
+
 };
 
 struct NeighborList;
@@ -291,7 +295,7 @@
    */
   char *message_buf;
 
-  /*
+  /**
    * Size of the message buf
    */
   size_t message_buf_size;
@@ -304,6 +308,11 @@
   struct TransportClient *client;
 
   /**
+   * Using which specific address should we send this message?
+   */
+  struct PeerAddressList *specific_peer;
+
+  /**
    * Neighbor this entry belongs to.
    */
   /*struct NeighborList *neighbor;*/
@@ -333,11 +342,6 @@
    */
   unsigned int priority;
 
-  /*
-   * Using which specific address should we send this message?
-   */
-  struct PeerAddressList *specific_peer;
-
 };
 
 
@@ -363,7 +367,7 @@
    */
   struct NeighborList *neighbor;
 
-  /*
+  /**
    * Transport addresses, latency, and readiness for
    * this particular plugin.
    */
@@ -377,7 +381,7 @@
    */
   int plugin_transmit_ready;
 
-  /*
+  /**
    * Are any of our PeerAddressList addresses still connected?
    */
   int connected; /* FIXME: dynamically check PeerAddressList addresses when 
asked to! */
@@ -437,6 +441,16 @@
   struct GNUNET_TIME_Absolute retry_plugins_time;
 
   /**
+   * The latency we have seen for this particular address for
+   * this particular peer.  This latency may have been calculated
+   * over multiple transports.  This value reflects how long it took
+   * us to receive a response when SENDING via this particular
+   * transport/neighbor/address combination!
+   * FIXME: why is this NBO?
+   */
+  struct GNUNET_TIME_RelativeNBO latency;
+
+  /**
    * How many bytes have we received since the "last_quota_update"
    * timestamp?
    */
@@ -462,14 +476,6 @@
    */
   int received_pong;
 
-  /* The latency we have seen for this particular address for
-   * this particular peer.  This latency may have been calculated
-   * over multiple transports.  This value reflects how long it took
-   * us to receive a response when SENDING via this particular
-   * transport/neighbor/address combination!
-   */
-  struct GNUNET_TIME_RelativeNBO latency;
-
 };
 
 /**
@@ -544,7 +550,7 @@
    */
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded signer;
 
-  /*
+  /**
    * Size of address appended to this message
    */
   size_t addrlen;
@@ -620,7 +626,7 @@
    */
   struct ValidationAddress *next;
 
-  /*
+  /**
    * What peer_address does this validation belong to?
    */
   struct PeerAddressList *peer_address;
@@ -635,7 +641,7 @@
    */
   struct GNUNET_TIME_Absolute expiration;
 
-  /*
+  /**
    * At what time did we send this validation?
    */
   struct GNUNET_TIME_Absolute send_time;
@@ -1218,7 +1224,7 @@
     mq->specific_peer->transmit_ready = GNUNET_NO;
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Giving message of size `%u' for `%4s' to plugin `%s'\n",
+              "Giving message of size %u for `%4s' to plugin `%s'\n",
               mq->message_buf_size,
               GNUNET_i2s (&neighbor->id), rl->plugin->short_name);
 #endif
@@ -1951,11 +1957,11 @@
   struct GNUNET_PeerIdentity id;
   struct NeighborList *neighbor;
   struct PeerAddressList *peer_address;
-  int sent;
+  ssize_t sent;
   struct TransportPingMessage *ping;
   char * message_buf;
-  int hello_size;
-  int tsize;
+  uint16_t hello_size;
+  size_t tsize;
 
   tp = find_transport (tname);
   if (tp == NULL)
@@ -2012,20 +2018,32 @@
   memcpy(&ping->target, &id, sizeof(struct GNUNET_PeerIdentity));
 
 #if DEBUG_TRANSPORT
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "hello size is %d, ping size is %d, 
total size is %d\n", hello_size, sizeof(struct TransportPingMessage), tsize);
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
+            "`%s' message size is %u, ping size is %u, total size is %u\n", 
+            "HELLO",
+            hello_size, 
+            sizeof(struct TransportPingMessage), 
+            tsize);
 #endif
   memcpy(message_buf, our_hello, hello_size);
-  memcpy(&message_buf[hello_size], ping, sizeof(struct TransportPingMessage));
+  memcpy(&message_buf[hello_size], 
+        ping, 
+        sizeof(struct TransportPingMessage));
 
 #if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ping message of size %d to 
address `%s' via `%s' for `%4s'\n",
-                tsize, GNUNET_a2s (addr, addrlen), tname, GNUNET_i2s (&id));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Sending `%s' message of size %u to address `%s' via `%s' for 
`%4s'\n",
+             "PING",
+             tsize, GNUNET_a2s (addr, addrlen), 
+             tname, GNUNET_i2s (&id));
 #endif
-  sent = transmit_to_peer(NULL, peer_address, 
GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                   message_buf, tsize, GNUNET_NO, neighbor);
+  sent = transmit_to_peer(NULL, peer_address, 
+                         GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+                         message_buf, tsize, GNUNET_NO, neighbor);
 
 #if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport returned %d from send!\n", 
sent);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+             "Transport returned %d from send!\n", sent);
 #endif
 
   GNUNET_free(ping);
@@ -2033,36 +2051,7 @@
   return GNUNET_OK;
 }
 
-#if WHY
-/*
- * @param cls handle to the plugin (for sending)
- * @param target the peer identity of the peer we are sending to
- * @param challenge the challenge number
- * @param timeout how long to await validation?
- * @param addr the address to validate
- * @param addrlen the length of the address
- *
- * Perform address validation, which means sending a PING PONG to
- * the address via the transport plugin.  If not validated, then
- * do not count this as a good peer/address...
- *
- * Currently this function is not used, ping/pongs get sent from the
- * run_validation function.  Haven't decided yet how to do this.
- */
-static void
-validate_address (void *cls, struct ValidationAddress *va,
-                  const struct GNUNET_PeerIdentity *target,
-                  struct GNUNET_TIME_Relative timeout,
-                  const void *addr, size_t addrlen)
-{
-  /* struct Plugin *plugin = cls;
-  int challenge = va->challenge; */
 
-
-  return;
-}
-#endif
-
 /**
  * Check if addresses in validated hello "h" overlap with
  * those in "chvc->hello" and update "chvc->hello" accordingly,
@@ -2479,7 +2468,7 @@
     }
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-              "Processing message of type `%u' received by plugin...\n",
+              "Processing message of type %u received by plugin...\n",
               ntohs (message->type));
 #endif
   if (service_context != NULL)

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2010-02-12 10:33:19 UTC (rev 10283)
+++ gnunet/src/transport/transport.h    2010-02-13 11:30:08 UTC (rev 10284)
@@ -30,7 +30,7 @@
 #include "gnunet_time_lib.h"
 #include "gnunet_transport_service.h"
 
-#define DEBUG_TRANSPORT GNUNET_NO
+#define DEBUG_TRANSPORT GNUNET_YES
 
 /**
  * For how long do we allow unused bandwidth





reply via email to

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