#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().
*/
void *value)
{
struct SessionCompareContext *cctx = cls;
- const struct GNUNET_HELLO_Address *address = cctx->address;
struct Session *s = value;
if (0 == GNUNET_HELLO_address_cmp (s->address,
else
{
GNUNET_STATISTICS_update (plugin->env->stats,
- "# UDP, total, bytes in buffers", udpw->msg_size, GNUNET_NO);
+ "# UDP, total, bytes in buffers",
+ udpw->msg_size,
+ GNUNET_NO);
plugin->bytes_in_buffer += udpw->msg_size;
}
GNUNET_STATISTICS_update (plugin->env->stats,
* 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,
flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "We received a sending delay of %s\n",
+ "We received a sending delay of %s for %s\n",
GNUNET_STRINGS_relative_time_to_string (flow_delay,
- GNUNET_YES));
+ GNUNET_YES),
+ GNUNET_i2s (&udp_ack->sender));
s->flow_delay_from_other_peer = GNUNET_TIME_relative_to_absolute (flow_delay);
ack = (const struct GNUNET_MessageHeader *) &udp_ack[1];
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Message full ACK'ed\n",
- (unsigned int ) ntohs (msg->size),
+ "Message from %s at %s full ACK'ed\n",
GNUNET_i2s (&udp_ack->sender),
udp_address_to_string (plugin,
udp_addr,