diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-14 18:58:07 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-14 18:58:07 +0000 |
commit | d525f2466043fa68adc5a96a2e95cc31ae1a6afb (patch) | |
tree | 869fb63e1ebb3d9b501ea7afc242dbf8e5a92827 /src | |
parent | 9858179cbb2a6b37c7a89f5fd20577a112259f15 (diff) | |
download | gnunet-d525f2466043fa68adc5a96a2e95cc31ae1a6afb.tar.gz gnunet-d525f2466043fa68adc5a96a2e95cc31ae1a6afb.zip |
work in progress
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index bb23c1b21..267f3c4e1 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -24,12 +24,7 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * TODO: | 26 | * TODO: |
27 | * - Need to SIGNAL connection in 'mark_address_connected' | ||
28 | * (if cnt == GNUNET_YES at the end!) | ||
29 | * - Need to SIGNAL disconnect when we no longer have any validated | ||
30 | * address (NAT case!) | ||
31 | * - Need to defer forwarding messages until after CONNECT message | 27 | * - Need to defer forwarding messages until after CONNECT message |
32 | * - MIGHT want to track connected state with neighbour | ||
33 | * - CHECK that 'address' being NULL in 'struct ForeignAddressList' is | 28 | * - CHECK that 'address' being NULL in 'struct ForeignAddressList' is |
34 | * tolerated in the code everywhere (could not happen before) | 29 | * tolerated in the code everywhere (could not happen before) |
35 | * | 30 | * |
@@ -997,6 +992,7 @@ mark_address_connected (struct ForeignAddressList *fal) | |||
997 | struct ForeignAddressList *pos; | 992 | struct ForeignAddressList *pos; |
998 | int cnt; | 993 | int cnt; |
999 | 994 | ||
995 | GNUNET_assert (GNUNET_YES == fal->validated); | ||
1000 | if (fal->connected == GNUNET_YES) | 996 | if (fal->connected == GNUNET_YES) |
1001 | return; /* nothing to do */ | 997 | return; /* nothing to do */ |
1002 | cnt = GNUNET_YES; | 998 | cnt = GNUNET_YES; |
@@ -1013,10 +1009,12 @@ mark_address_connected (struct ForeignAddressList *fal) | |||
1013 | } | 1009 | } |
1014 | fal->connected = GNUNET_YES; | 1010 | fal->connected = GNUNET_YES; |
1015 | if (GNUNET_YES == cnt) | 1011 | if (GNUNET_YES == cnt) |
1016 | GNUNET_STATISTICS_update (stats, | 1012 | { |
1017 | gettext_noop ("# connected addresses"), | 1013 | GNUNET_STATISTICS_update (stats, |
1018 | 1, | 1014 | gettext_noop ("# connected addresses"), |
1019 | GNUNET_NO); | 1015 | 1, |
1016 | GNUNET_NO); | ||
1017 | } | ||
1020 | } | 1018 | } |
1021 | 1019 | ||
1022 | 1020 | ||
@@ -1140,7 +1138,8 @@ transmit_send_continuation (void *cls, | |||
1140 | mq->specific_address->timeout = | 1138 | mq->specific_address->timeout = |
1141 | GNUNET_TIME_relative_to_absolute | 1139 | GNUNET_TIME_relative_to_absolute |
1142 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1140 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1143 | mark_address_connected (mq->specific_address); | 1141 | if (mq->specific_address->validated == GNUNET_YES) |
1142 | mark_address_connected (mq->specific_address); | ||
1144 | } | 1143 | } |
1145 | else | 1144 | else |
1146 | { | 1145 | { |
@@ -1743,6 +1742,18 @@ plugin_env_session_end (void *cls, | |||
1743 | else | 1742 | else |
1744 | prev->next = pos->next; | 1743 | prev->next = pos->next; |
1745 | GNUNET_free (pos); | 1744 | GNUNET_free (pos); |
1745 | if (nl->received_pong == GNUNET_NO) | ||
1746 | return; /* nothing to do */ | ||
1747 | /* check if we have any validated addresses left */ | ||
1748 | pos = rl->addresses; | ||
1749 | while (pos != NULL) | ||
1750 | { | ||
1751 | if (pos->validated) | ||
1752 | return; | ||
1753 | pos = pos->next; | ||
1754 | } | ||
1755 | /* no valid addresses left, signal disconnect! */ | ||
1756 | disconnect_neighbour (nl, GNUNET_NO); | ||
1746 | } | 1757 | } |
1747 | 1758 | ||
1748 | 1759 | ||
@@ -3728,7 +3739,8 @@ create_environment (struct TransportPlugin *plug) | |||
3728 | * Start the specified transport (load the plugin). | 3739 | * Start the specified transport (load the plugin). |
3729 | */ | 3740 | */ |
3730 | static void | 3741 | static void |
3731 | start_transport (struct GNUNET_SERVER_Handle *server, const char *name) | 3742 | start_transport (struct GNUNET_SERVER_Handle *server, |
3743 | const char *name) | ||
3732 | { | 3744 | { |
3733 | struct TransportPlugin *plug; | 3745 | struct TransportPlugin *plug; |
3734 | char *libname; | 3746 | char *libname; |