*/
static void
handle_payload_message (const struct GNUNET_MessageHeader *message,
- struct NeighbourList *n)
+ struct NeighbourList *n)
{
struct InboundMessage *im;
struct TransportClient *cpos;
{
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message of type %u and size %u from `%4s', but no pong yet!!\n",
+ "Received message of type %u and size %u from `%4s', but no pong yet!\n",
ntohs (message->type),
ntohs (message->size),
GNUNET_i2s (&n->id));
uint16_t msize;
struct NeighbourList *n;
struct GNUNET_TIME_Relative ret;
- if (is_blacklisted (peer, plugin))
- return GNUNET_TIME_UNIT_FOREVER_REL;
uint32_t distance;
int c;
+ if (is_blacklisted (peer, plugin))
+ return GNUNET_TIME_UNIT_FOREVER_REL;
n = find_neighbour (peer);
if (n == NULL)
n = setup_new_neighbour (peer, GNUNET_YES);
distance = 1;
for (c=0; c<ats_count; c++)
- {
- if (ntohl(ats_data[c].type) == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
- {
- distance = ntohl(ats_data[c].value);
- }
- }
-
+ if (ntohl(ats_data[c].type) == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
+ distance = ntohl(ats_data[c].value);
+
/* notify ATS about incoming data */
//ats_notify_ats_data(peer, ats_data);
-
if (message != NULL)
{
if ( (session != NULL) ||
sender_address_len);
if (peer_address != NULL)
{
-
- update_addr_ats(peer_address, ats_data, ats_count);
- update_addr_value(peer_address, distance, GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
-
- peer_address->distance = distance;
+ update_addr_ats(peer_address, ats_data, ats_count);
+ update_addr_value(peer_address, distance, GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+
+ peer_address->distance = distance;
if (GNUNET_YES == peer_address->validated)
mark_address_connected (peer_address);
peer_address->timeout
- =
- GNUNET_TIME_relative_to_absolute
- (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+ = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
schedule_next_ping (peer_address);
}
/* update traffic received amount ... */
}
if ((ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ATS) &&
(ntohs(message->size) == (sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t))))
- {
+ {
uint32_t value = ntohl(*((uint32_t *) &message[1]));
//GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value);
/* Force ressource and quality update */
if (value == 4)
- {
- ats->stat.modified_resources = GNUNET_YES;
- ats->stat.modified_quality = GNUNET_YES;
- }
+ {
+ ats->stat.modified_resources = GNUNET_YES;
+ ats->stat.modified_quality = GNUNET_YES;
+ }
/* Force cost update */
if (value == 3)
- ats->stat.modified_resources = GNUNET_YES;
+ ats->stat.modified_resources = GNUNET_YES;
/* Force quality update */
if (value == 2)
- ats->stat.modified_quality = GNUNET_YES;
+ ats->stat.modified_quality = GNUNET_YES;
/* Force full rebuild */
if (value == 1)
- ats->stat.recreate_problem = GNUNET_YES;
- }
-
+ ats->stat.recreate_problem = GNUNET_YES;
+ }
+
#if DEBUG_PING_PONG
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message of type %u and size %u from `%4s', sending to all clients.\n",
- ntohs (message->type),
- ntohs (message->size),
- GNUNET_i2s (peer));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received message of type %u and size %u from `%4s', sending to all clients.\n",
+ ntohs (message->type),
+ ntohs (message->size),
+ GNUNET_i2s (peer));
#endif
switch (ntohs (message->type))
{
ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0);
if (ret.rel_value > 0)
{
-#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Throttling read (%llu bytes excess at %u b/s), waiting %llums before reading more.\n",
+#if DEBUG_TRANSPORT || 1
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n",
(unsigned long long) n->in_tracker.consumption_since_last_update__,
(unsigned int) n->in_tracker.available_bytes_per_s__,
(unsigned long long) ret.rel_value);
(GNUNET_YES == session->inbound) ? NULL : session->connect_addr,
(GNUNET_YES == session->inbound) ? 0 : session->connect_alen);
if (delay.rel_value == 0)
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ {
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ }
else
- session->receive_delay_task =
- GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
+ {
+#if DEBUG_TCP || 1
+ GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+ "tcp",
+ "Throttling receiving from `%s' for %llu ms\n",
+ GNUNET_i2s (&session->target),
+ (unsigned long long) delay.rel_value);
+#endif
+ session->receive_delay_task =
+ GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
+ }
}
}
if ((bind_address != NULL) && (internal_address != NULL))
- {
- if (0 != strcmp(internal_address, bind_address ))
- {
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
- "tcp","Specific bind address `%s' and internal address `%s' must not differ, forcing internal address to bind address!\n", bind_address, internal_address);
- GNUNET_free (internal_address);
- internal_address = bind_address;
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
- "tcp","New internal address `%s'\n", internal_address);
- }
- }
-
+ {
+ if (0 != strcmp(internal_address, bind_address ))
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "tcp",
+ "Specific bind address `%s' and internal address `%s' must not differ, forcing internal address to bind address!\n",
+ bind_address, internal_address);
+ GNUNET_free (internal_address);
+ internal_address = bind_address;
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "tcp","New internal address `%s'\n", internal_address);
+ }
+ }
+
aport = 0;
if ( (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (env->cfg,
use_localaddresses = GNUNET_NO;
if (GNUNET_CONFIGURATION_have_value (env->cfg,
- "transport-tcp", "USE_LOCALADDR"))
+ "transport-tcp", "USE_LOCALADDR"))
{
- use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
- "transport-tcp",
- "USE_LOCALADDR");
+ use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "transport-tcp",
+ "USE_LOCALADDR");
}
-
+
if (aport == 0)
aport = bport;
if (bport == 0)