aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-24 09:20:57 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-24 09:20:57 +0000
commit5410fb6ff08295ea4d38cbc3bdbc9eb27c8f0128 (patch)
tree85ef07d0401ca08ad135d41be9b27e9c000fd367 /src/transport/gnunet-service-transport_neighbours.c
parent8285935ab9d48f6cb49837a872ab9df67f04690f (diff)
downloadgnunet-5410fb6ff08295ea4d38cbc3bdbc9eb27c8f0128.tar.gz
gnunet-5410fb6ff08295ea4d38cbc3bdbc9eb27c8f0128.zip
-attempting to fix LRN's NAT connect issue
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 918299fef..ecf1bb212 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1749,6 +1749,15 @@ handle_test_blacklist_cont (void *cls,
1749 (GNUNET_OK == result) ? "allowed" : "FORBIDDEN"); 1749 (GNUNET_OK == result) ? "allowed" : "FORBIDDEN");
1750 if (NULL == (n = lookup_neighbour (peer))) 1750 if (NULL == (n = lookup_neighbour (peer)))
1751 goto cleanup; /* nobody left to care about new address */ 1751 goto cleanup; /* nobody left to care about new address */
1752 if (GNUNET_OK == result)
1753 {
1754 /* valid new address, let ATS know (regardless of where we are
1755 in the state machine) */
1756 GNUNET_ATS_address_add (GST_ats,
1757 bcc->na.address,
1758 bcc->na.session,
1759 bcc->ats, bcc->ats_count);
1760 }
1752 switch (n->state) 1761 switch (n->state)
1753 { 1762 {
1754 case S_NOT_CONNECTED: 1763 case S_NOT_CONNECTED:
@@ -1792,25 +1801,31 @@ handle_test_blacklist_cont (void *cls,
1792 } 1801 }
1793 break; 1802 break;
1794 case S_CONNECT_SENT: 1803 case S_CONNECT_SENT:
1795 /* waiting on CONNECT_ACK, send ACK if one is pending */ 1804 /* waiting on CONNECT_ACK, switch session and send ACK if one is pending */
1796 if ( (GNUNET_OK == result) && 1805 if ( (GNUNET_OK == result) &&
1797 (1 == n->send_connect_ack) ) 1806 (1 == n->send_connect_ack) )
1798 { 1807 {
1799 n->send_connect_ack = 2; 1808 n->send_connect_ack = 2;
1809 /* FIXME: we might be switching to a different address here without
1810 asking (or telling!) ATS; while this is done for a good reason --
1811 our CONNECT was not answered, but we got another session with
1812 a CONNECT from the other peer, so maybe this is an inbound session
1813 that actually works -- this is unclean as ATS needs to be told
1814 about this (or even asked first!?) Anyway, I'm adding this as
1815 something expermental for now to see if it fixes issues LRN reported
1816 on IRC on 24/6/2012. */
1817 set_address (&n->primary_address,
1818 bcc->na.address,
1819 bcc->na.session,
1820 n->primary_address.bandwidth_in,
1821 n->primary_address.bandwidth_out,
1822 GNUNET_YES);
1800 send_session_connect_ack_message (n->primary_address.address, 1823 send_session_connect_ack_message (n->primary_address.address,
1801 n->primary_address.session, 1824 n->primary_address.session,
1802 n->connect_ack_timestamp); 1825 n->connect_ack_timestamp);
1803 } 1826 }
1804 break; 1827 break;
1805 case S_CONNECT_RECV_BLACKLIST_INBOUND: 1828 case S_CONNECT_RECV_BLACKLIST_INBOUND:
1806 if (GNUNET_OK == result)
1807 {
1808 /* valid new address, let ATS know! */
1809 GNUNET_ATS_address_add (GST_ats,
1810 bcc->na.address,
1811 bcc->na.session,
1812 bcc->ats, bcc->ats_count);
1813 }
1814 n->state = S_CONNECT_RECV_ATS; 1829 n->state = S_CONNECT_RECV_ATS;
1815 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 1830 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
1816 GNUNET_ATS_reset_backoff (GST_ats, peer); 1831 GNUNET_ATS_reset_backoff (GST_ats, peer);
@@ -2091,9 +2106,8 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2091 /* get rid of remains without terminating sessions, ready to re-try */ 2106 /* get rid of remains without terminating sessions, ready to re-try */
2092 free_neighbour (n, GNUNET_YES); 2107 free_neighbour (n, GNUNET_YES);
2093 n = setup_neighbour (peer); 2108 n = setup_neighbour (peer);
2094 n->state = S_CONNECT_RECV_ATS; 2109 n->state = S_CONNECT_RECV_BLACKLIST_INBOUND;
2095 GNUNET_ATS_reset_backoff (GST_ats, peer); 2110 check_blacklist (peer, ts, address, session, ats, ats_count);
2096 GNUNET_ATS_suggest_address (GST_ats, peer);
2097 break; 2111 break;
2098 case S_DISCONNECT_FINISHED: 2112 case S_DISCONNECT_FINISHED:
2099 /* should not be possible */ 2113 /* should not be possible */