gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35328 - gnunet/src/transport
Date: Sun, 1 Mar 2015 14:55:15 +0100

Author: grothoff
Date: 2015-03-01 14:55:15 +0100 (Sun, 01 Mar 2015)
New Revision: 35328

Modified:
   gnunet/src/transport/plugin_transport_udp.c
Log:
-simplify logic

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2015-03-01 01:12:22 UTC (rev 
35327)
+++ gnunet/src/transport/plugin_transport_udp.c 2015-03-01 13:55:15 UTC (rev 
35328)
@@ -42,6 +42,9 @@
 
 #define LOG(kind,...) GNUNET_log_from (kind, "transport-udp", __VA_ARGS__)
 
+/**
+ * After how much inactivity should a UDP session time out?
+ */
 #define UDP_SESSION_TIME_OUT GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 60)
 
 /**
@@ -57,7 +60,7 @@
 /**
  * We keep a defragmentation queue per sender address.  How many
  * sender addresses do we support at the same time? Memory consumption
- * is roughly a factor of 32k * UDP_MAX_MESSAGES_IN_DEFRAG times this
+ * is roughly a factor of 32k * #UDP_MAX_MESSAGES_IN_DEFRAG times this
  * value. (So 128 corresponds to 12 MB and should suffice for
  * connecting to roughly 128 peers via UDP).
  */
@@ -211,23 +214,6 @@
 
 
 /**
- * Closure for #process_inbound_tokenized_messages().
- */
-struct SourceInformation
-{
-  /**
-   * Sender identity.
-   */
-  struct GNUNET_PeerIdentity sender;
-
-  /**
-   * Associated session.
-   */
-  struct Session *session;
-
-};
-
-/**
  * Closure for #find_receive_context().
  */
 struct FindReceiveContext
@@ -2242,7 +2228,7 @@
  * to the service.
  *
  * @param cls the `struct Plugin *`
- * @param client the `struct SourceInformation *`
+ * @param client the `struct Session *`
  * @param hdr the actual message
  * @return #GNUNET_OK (always)
  */
@@ -2252,19 +2238,18 @@
                                     const struct GNUNET_MessageHeader *hdr)
 {
   struct Plugin *plugin = cls;
-  struct SourceInformation *si = client;
+  struct Session *session = client;
   struct GNUNET_TIME_Relative delay;
 
-  GNUNET_assert (NULL != si->session);
-  if (GNUNET_YES == si->session->in_destroy)
+  if (GNUNET_YES == session->in_destroy)
     return GNUNET_OK;
   /* setup ATS */
-  reschedule_session_timeout (si->session);
+  reschedule_session_timeout (session);
   delay = plugin->env->receive (plugin->env->cls,
-                                si->session->address,
-                                si->session,
+                                session->address,
+                                session,
                                 hdr);
-  si->session->flow_delay_for_other_peer = delay;
+  session->flow_delay_for_other_peer = delay;
   return GNUNET_OK;
 }
 
@@ -2285,7 +2270,6 @@
                      size_t udp_addr_len,
                      enum GNUNET_ATS_Network_Type network_type)
 {
-  struct SourceInformation si;
   struct Session *s;
   struct GNUNET_HELLO_Address *address;
 
@@ -2327,11 +2311,9 @@
   GNUNET_free (address);
 
   /* iterate over all embedded messages */
-  si.session = s;
-  si.sender = msg->sender;
   s->rc++;
   GNUNET_SERVER_mst_receive (plugin->mst,
-                             &si,
+                             s,
                              (const char *) &msg[1],
                              ntohs (msg->header.size) - sizeof(struct 
UDPMessage),
                              GNUNET_YES,




reply via email to

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