[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17980 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17980 - gnunet/src/transport |
Date: |
Fri, 4 Nov 2011 10:47:41 +0100 |
Author: wachs
Date: 2011-11-04 10:47:40 +0100 (Fri, 04 Nov 2011)
New Revision: 17980
Modified:
gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
additional checks due to mantis 0001868
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-11-04
09:45:03 UTC (rev 17979)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-11-04
09:47:40 UTC (rev 17980)
@@ -1200,29 +1200,47 @@
struct SessionConnectMessage connect_msg;
size_t msg_len;
size_t ret;
+ int checks_failed;
// This can happen during shutdown
if (neighbours == NULL)
{
return GNUNET_NO;
}
+
+ checks_failed = GNUNET_NO;
+
+ if (plugin_name == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "ATS offered suggested us empty address: plugin NULL");
+ GNUNET_break_op(0);
+ checks_failed = GNUNET_YES;
+ }
+ if ((address == NULL) && (address_len == 0 ))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "ATS offered suggested us empty address: address NULL");
+ GNUNET_break_op(0);
+ checks_failed = GNUNET_YES;
+ }
+
n = lookup_neighbour (peer);
if (NULL == n)
+ checks_failed = GNUNET_YES;
+
+ if (checks_failed == GNUNET_YES)
{
- if (NULL == session)
- GNUNET_ATS_address_destroyed (GST_ats,
- peer,
- plugin_name, address,
- address_len, NULL);
+ GNUNET_ATS_address_destroyed (GST_ats,
+ peer,
+ plugin_name, address,
+ address_len, session);
+ if (n != NULL)
+ GNUNET_ATS_suggest_address(GST_ats, peer);
return GNUNET_NO;
}
- if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel(n->ats_suggest);
- n->ats_suggest = GNUNET_SCHEDULER_NO_TASK;
- }
-
+ /* checks successful and neighbour != NULL */
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"ATS tells us to switch to plugin `%s' address '%s' session %X
for %s peer `%s'\n",
@@ -1234,35 +1252,38 @@
GNUNET_i2s (peer));
#endif
+ if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel(n->ats_suggest);
+ n->ats_suggest = GNUNET_SCHEDULER_NO_TASK;
+ }
+
// do not switch addresses just update quotas
- if (n != NULL)
+ if ((is_connected(n)) && (address_len == n->addrlen))
{
- if ((is_connected(n)) && (address_len == n->addrlen))
+ if ((0 == memcmp (address, n->addr, address_len)) &&
+ (n->session == session))
{
- if ((0 == memcmp (address, n->addr, address_len)) &&
- (n->session == session))
- {
- struct QuotaSetMessage q_msg;
+ struct QuotaSetMessage q_msg;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending outbound quota of %u Bps and inbound quota of %u Bps
for peer `%s' to all clients\n",
- ntohl (n->bandwidth_out.value__),
- ntohl (n->bandwidth_in.value__),
- GNUNET_i2s (peer));
+GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending outbound quota of %u Bps and inbound quota of %u Bps for
peer `%s' to all clients\n",
+ ntohl (n->bandwidth_out.value__),
+ ntohl (n->bandwidth_in.value__),
+ GNUNET_i2s (peer));
#endif
- n->bandwidth_in = bandwidth_in;
- n->bandwidth_out = bandwidth_out;
- GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in);
+ n->bandwidth_in = bandwidth_in;
+ n->bandwidth_out = bandwidth_out;
+ GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in);
- q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
- q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
- q_msg.quota = n->bandwidth_out;
- q_msg.peer = (*peer);
- GST_clients_broadcast (&q_msg.header, GNUNET_NO);
- return GNUNET_NO;
- }
+ q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
+ q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
+ q_msg.quota = n->bandwidth_out;
+ q_msg.peer = (*peer);
+ GST_clients_broadcast (&q_msg.header, GNUNET_NO);
+ return GNUNET_NO;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17980 - gnunet/src/transport,
gnunet <=