#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)
/**
/**
* 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).
*/
};
-/**
- * Closure for #process_inbound_tokenized_messages().
- */
-struct SourceInformation
-{
- /**
- * Sender identity.
- */
- struct GNUNET_PeerIdentity sender;
-
- /**
- * Associated session.
- */
- struct Session *session;
-
-};
-
/**
* Closure for #find_receive_context().
*/
* 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)
*/
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;
}
size_t udp_addr_len,
enum GNUNET_ATS_Network_Type network_type)
{
- struct SourceInformation si;
struct Session *s;
struct GNUNET_HELLO_Address *address;
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,