diff options
-rw-r--r-- | src/transport/gnunet-service-transport.c | 15 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.c | 34 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.h | 11 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 46 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 33 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 41 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 16 |
8 files changed, 138 insertions, 68 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 5126dad96..b21b0c384 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -732,11 +732,15 @@ plugin_env_session_start (void *cls, | |||
732 | session, | 732 | session, |
733 | GNUNET_i2s (&address->peer), | 733 | GNUNET_i2s (&address->peer), |
734 | GST_plugins_a2s (address)); | 734 | GST_plugins_a2s (address)); |
735 | if (GNUNET_YES == | 735 | if ( (GNUNET_YES == |
736 | GNUNET_HELLO_address_check_option (address, | 736 | GNUNET_HELLO_address_check_option (address, |
737 | GNUNET_HELLO_ADDRESS_INFO_INBOUND)) | 737 | GNUNET_HELLO_ADDRESS_INFO_INBOUND)) || |
738 | (GNUNET_NO == | ||
739 | GST_ats_is_known (address, session) ) ) | ||
738 | { | 740 | { |
739 | /* inbound is always new */ | 741 | /* inbound is always new, but outbound MAY already be known, but |
742 | for example for UNIX, we have symmetric connections and thus we | ||
743 | may not know the address yet; add if necessary! */ | ||
740 | GST_ats_add_address (address, | 744 | GST_ats_add_address (address, |
741 | session, | 745 | session, |
742 | ats, | 746 | ats, |
@@ -744,7 +748,6 @@ plugin_env_session_start (void *cls, | |||
744 | } | 748 | } |
745 | else | 749 | else |
746 | { | 750 | { |
747 | /* outbound should already be known */ | ||
748 | GST_ats_new_session (address, | 751 | GST_ats_new_session (address, |
749 | session); | 752 | session); |
750 | GST_ats_update_metrics (address, | 753 | GST_ats_update_metrics (address, |
@@ -923,8 +926,8 @@ shutdown_task (void *cls, | |||
923 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 926 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
924 | { | 927 | { |
925 | GST_neighbours_stop (); | 928 | GST_neighbours_stop (); |
926 | GST_validation_stop (); | ||
927 | GST_plugins_unload (); | 929 | GST_plugins_unload (); |
930 | GST_validation_stop (); | ||
928 | GST_ats_done (); | 931 | GST_ats_done (); |
929 | GNUNET_ATS_scheduling_done (GST_ats); | 932 | GNUNET_ATS_scheduling_done (GST_ats); |
930 | GST_ats = NULL; | 933 | GST_ats = NULL; |
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 4fcf7c9dc..a660f252f 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c | |||
@@ -108,6 +108,8 @@ find_ai_cb (void *cls, | |||
108 | fc->ret = ai; | 108 | fc->ret = ai; |
109 | return GNUNET_NO; | 109 | return GNUNET_NO; |
110 | } | 110 | } |
111 | GNUNET_assert ( (fc->session != ai->session) || | ||
112 | (NULL == ai->session) ); | ||
111 | return GNUNET_YES; | 113 | return GNUNET_YES; |
112 | } | 114 | } |
113 | 115 | ||
@@ -138,6 +140,21 @@ find_ai (const struct GNUNET_HELLO_Address *address, | |||
138 | 140 | ||
139 | 141 | ||
140 | /** | 142 | /** |
143 | * Test if ATS knows about this address. | ||
144 | * | ||
145 | * @param address the address | ||
146 | * @param session the session | ||
147 | * @return #GNUNET_YES if address is known, #GNUNET_NO if not. | ||
148 | */ | ||
149 | int | ||
150 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | ||
151 | struct Session *session) | ||
152 | { | ||
153 | return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO; | ||
154 | } | ||
155 | |||
156 | |||
157 | /** | ||
141 | * Notify ATS about the new address including the network this address is | 158 | * Notify ATS about the new address including the network this address is |
142 | * located in. | 159 | * located in. |
143 | * | 160 | * |
@@ -183,7 +200,7 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address, | |||
183 | if (NULL == (papi = GST_plugins_find (address->transport_name))) | 200 | if (NULL == (papi = GST_plugins_find (address->transport_name))) |
184 | { | 201 | { |
185 | /* we don't have the plugin for this address */ | 202 | /* we don't have the plugin for this address */ |
186 | GNUNET_break(0); | 203 | GNUNET_assert (0); |
187 | return; | 204 | return; |
188 | } | 205 | } |
189 | if (NULL != session) | 206 | if (NULL != session) |
@@ -244,7 +261,12 @@ GST_ats_new_session (const struct GNUNET_HELLO_Address *address, | |||
244 | ai = find_ai (address, NULL); | 261 | ai = find_ai (address, NULL); |
245 | if (NULL == ai) | 262 | if (NULL == ai) |
246 | { | 263 | { |
247 | GNUNET_break (NULL != (find_ai (address, session))); | 264 | /* We may already be aware of the session, even if some other part |
265 | of the code could not tell if it just created a new session or | ||
266 | just got one recycled from the plugin; hence, we may be called | ||
267 | with "new" session even for an "old" session; in that case, | ||
268 | check that this is the case, but just ignore it. */ | ||
269 | GNUNET_assert (NULL != (find_ai (address, session))); | ||
248 | return; | 270 | return; |
249 | } | 271 | } |
250 | GNUNET_break (NULL == ai->session); | 272 | GNUNET_break (NULL == ai->session); |
@@ -330,9 +352,9 @@ GST_ats_update_metrics (const struct GNUNET_HELLO_Address *address, | |||
330 | and if we get metrics for those, they were never known to | 352 | and if we get metrics for those, they were never known to |
331 | ATS which means we end up here (however, in this | 353 | ATS which means we end up here (however, in this |
332 | case, the address must be an outbound address). */ | 354 | case, the address must be an outbound address). */ |
333 | GNUNET_break (GNUNET_YES != | 355 | GNUNET_assert (GNUNET_YES != |
334 | GNUNET_HELLO_address_check_option (address, | 356 | GNUNET_HELLO_address_check_option (address, |
335 | GNUNET_HELLO_ADDRESS_INFO_INBOUND)); | 357 | GNUNET_HELLO_ADDRESS_INFO_INBOUND)); |
336 | 358 | ||
337 | return; | 359 | return; |
338 | } | 360 | } |
@@ -394,7 +416,7 @@ GST_ats_expire_address (const struct GNUNET_HELLO_Address *address) | |||
394 | ai = find_ai (address, NULL); | 416 | ai = find_ai (address, NULL); |
395 | if (NULL == ai) | 417 | if (NULL == ai) |
396 | { | 418 | { |
397 | GNUNET_break (0); | 419 | GNUNET_assert (0); |
398 | return; | 420 | return; |
399 | } | 421 | } |
400 | GNUNET_assert (GNUNET_YES == | 422 | GNUNET_assert (GNUNET_YES == |
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h index b066ad74f..b203cc323 100644 --- a/src/transport/gnunet-service-transport_ats.h +++ b/src/transport/gnunet-service-transport_ats.h | |||
@@ -51,6 +51,17 @@ GST_ats_done (void); | |||
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Test if ATS knows about this address. | ||
55 | * | ||
56 | * @param address the address | ||
57 | * @param session the session | ||
58 | * @return #GNUNET_YES if address is known, #GNUNET_NO if not. | ||
59 | */ | ||
60 | int | ||
61 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | ||
62 | struct Session *session); | ||
63 | |||
64 | /** | ||
54 | * Notify ATS about the new address including the network this address is | 65 | * Notify ATS about the new address including the network this address is |
55 | * located in. | 66 | * located in. |
56 | * | 67 | * |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index c7459680f..e13bca139 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -800,11 +800,11 @@ set_alternative_address (struct NeighbourMapEntry *n, | |||
800 | */ | 800 | */ |
801 | static void | 801 | static void |
802 | set_primary_address (struct NeighbourMapEntry *n, | 802 | set_primary_address (struct NeighbourMapEntry *n, |
803 | const struct GNUNET_HELLO_Address *address, | 803 | const struct GNUNET_HELLO_Address *address, |
804 | struct Session *session, | 804 | struct Session *session, |
805 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 805 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
806 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 806 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
807 | int is_active) | 807 | int is_active) |
808 | { | 808 | { |
809 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 809 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
810 | 810 | ||
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 01a4eade8..770525f21 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2261,8 +2261,9 @@ handle_tcp_welcome (void *cls, | |||
2261 | struct GNUNET_ATS_Information ats; | 2261 | struct GNUNET_ATS_Information ats; |
2262 | 2262 | ||
2263 | 2263 | ||
2264 | if (0 == memcmp (&wm->clientIdentity, plugin->env->my_identity, | 2264 | if (0 == memcmp (&wm->clientIdentity, |
2265 | sizeof(struct GNUNET_PeerIdentity))) | 2265 | plugin->env->my_identity, |
2266 | sizeof(struct GNUNET_PeerIdentity))) | ||
2266 | { | 2267 | { |
2267 | /* refuse connections from ourselves */ | 2268 | /* refuse connections from ourselves */ |
2268 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2269 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
@@ -2277,10 +2278,14 @@ handle_tcp_welcome (void *cls, | |||
2277 | return; | 2278 | return; |
2278 | } | 2279 | } |
2279 | 2280 | ||
2280 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Received %s message from `%4s' %p\n", "WELCOME", | 2281 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
2282 | "Received %s message from `%4s' %p\n", | ||
2283 | "WELCOME", | ||
2281 | GNUNET_i2s (&wm->clientIdentity), client); | 2284 | GNUNET_i2s (&wm->clientIdentity), client); |
2282 | GNUNET_STATISTICS_update (plugin->env->stats, | 2285 | GNUNET_STATISTICS_update (plugin->env->stats, |
2283 | gettext_noop ("# TCP WELCOME messages received"), 1, GNUNET_NO); | 2286 | gettext_noop ("# TCP WELCOME messages received"), |
2287 | 1, | ||
2288 | GNUNET_NO); | ||
2284 | session = lookup_session_by_client (plugin, client); | 2289 | session = lookup_session_by_client (plugin, client); |
2285 | if (NULL != session) | 2290 | if (NULL != session) |
2286 | { | 2291 | { |
@@ -2288,8 +2293,9 @@ handle_tcp_welcome (void *cls, | |||
2288 | { | 2293 | { |
2289 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2294 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2290 | "Found existing session %p for peer `%s'\n", | 2295 | "Found existing session %p for peer `%s'\n", |
2291 | session, GNUNET_a2s (vaddr, alen)); | 2296 | session, |
2292 | GNUNET_free(vaddr); | 2297 | GNUNET_a2s (vaddr, alen)); |
2298 | GNUNET_free (vaddr); | ||
2293 | } | 2299 | } |
2294 | } | 2300 | } |
2295 | else | 2301 | else |
@@ -2337,23 +2343,27 @@ handle_tcp_welcome (void *cls, | |||
2337 | session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen); | 2343 | session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen); |
2338 | ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); | 2344 | ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); |
2339 | ats.value = htonl (session->ats_address_network_type); | 2345 | ats.value = htonl (session->ats_address_network_type); |
2340 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2346 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2341 | "Creating new%s session %p for peer `%s' client %p \n", | 2347 | "Creating new%s session %p for peer `%s' client %p \n", |
2342 | GNUNET_HELLO_address_check_option (session->address, | 2348 | GNUNET_HELLO_address_check_option (session->address, |
2343 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) | 2349 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) |
2344 | ? " inbound" : "", | 2350 | ? " inbound" : "", |
2345 | session, | 2351 | session, |
2346 | tcp_plugin_address_to_string(NULL, (void *) session->address->address, | 2352 | tcp_plugin_address_to_string (NULL, |
2347 | session->address->address_length), | 2353 | (void *) session->address->address, |
2348 | client); | 2354 | session->address->address_length), |
2349 | GNUNET_free(vaddr); | 2355 | client); |
2350 | GNUNET_SERVER_client_set_user_context(session->client, session); | 2356 | GNUNET_free (vaddr); |
2357 | GNUNET_SERVER_client_set_user_context (session->client, session); | ||
2351 | GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, | 2358 | GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, |
2352 | &session->target, | 2359 | &session->target, |
2353 | session, | 2360 | session, |
2354 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2361 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2355 | /* Notify transport and ATS about new session */ | 2362 | /* Notify transport and ATS about new session */ |
2356 | plugin->env->session_start (NULL, session->address, session, &ats, 1); | 2363 | plugin->env->session_start (plugin->env->cls, |
2364 | session->address, | ||
2365 | session, | ||
2366 | &ats, 1); | ||
2357 | notify_session_monitor (plugin, | 2367 | notify_session_monitor (plugin, |
2358 | session, | 2368 | session, |
2359 | GNUNET_TRANSPORT_SS_INIT); | 2369 | GNUNET_TRANSPORT_SS_INIT); |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 76c9dfdec..5b882af26 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1327,10 +1327,13 @@ udp_disconnect_session (void *cls, | |||
1327 | struct UDP_MessageWrapper *next; | 1327 | struct UDP_MessageWrapper *next; |
1328 | struct FindReceiveContext frc; | 1328 | struct FindReceiveContext frc; |
1329 | 1329 | ||
1330 | GNUNET_assert(GNUNET_YES != s->in_destroy); | 1330 | GNUNET_assert (GNUNET_YES != s->in_destroy); |
1331 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' address ended\n", s, | 1331 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
1332 | "Session %p to peer `%s' address ended\n", s, | ||
1332 | GNUNET_i2s (&s->target), | 1333 | GNUNET_i2s (&s->target), |
1333 | udp_address_to_string (NULL, s->address->address, s->address->address_length)); | 1334 | udp_address_to_string (NULL, |
1335 | s->address->address, | ||
1336 | s->address->address_length)); | ||
1334 | /* stop timeout task */ | 1337 | /* stop timeout task */ |
1335 | if (NULL != s->timeout_task) | 1338 | if (NULL != s->timeout_task) |
1336 | { | 1339 | { |
@@ -1405,10 +1408,10 @@ udp_disconnect_session (void *cls, | |||
1405 | } | 1408 | } |
1406 | } | 1409 | } |
1407 | 1410 | ||
1408 | GNUNET_assert(GNUNET_YES == | 1411 | GNUNET_assert (GNUNET_YES == |
1409 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, | 1412 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, |
1410 | &s->target, | 1413 | &s->target, |
1411 | s)); | 1414 | s)); |
1412 | GNUNET_STATISTICS_set (plugin->env->stats, | 1415 | GNUNET_STATISTICS_set (plugin->env->stats, |
1413 | "# UDP sessions active", | 1416 | "# UDP sessions active", |
1414 | GNUNET_CONTAINER_multipeermap_size (plugin->sessions), | 1417 | GNUNET_CONTAINER_multipeermap_size (plugin->sessions), |
@@ -2335,7 +2338,8 @@ process_udp_message (struct Plugin *plugin, | |||
2335 | address = GNUNET_HELLO_address_allocate ( &msg->sender, PLUGIN_NAME, | 2338 | address = GNUNET_HELLO_address_allocate ( &msg->sender, PLUGIN_NAME, |
2336 | arg, args, | 2339 | arg, args, |
2337 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | 2340 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); |
2338 | if (NULL == (s = udp_plugin_lookup_session (plugin, address))) | 2341 | if ( (NULL == (s = udp_plugin_lookup_session (plugin, address))) && |
2342 | (GNUNET_YES != s->in_destroy) ) | ||
2339 | { | 2343 | { |
2340 | s = udp_plugin_create_session (plugin, address); | 2344 | s = udp_plugin_create_session (plugin, address); |
2341 | plugin->env->session_start (NULL, address, s, NULL, 0); | 2345 | plugin->env->session_start (NULL, address, s, NULL, 0); |
@@ -2354,9 +2358,12 @@ process_udp_message (struct Plugin *plugin, | |||
2354 | si.arg = arg; | 2358 | si.arg = arg; |
2355 | si.args = args; | 2359 | si.args = args; |
2356 | s->rc++; | 2360 | s->rc++; |
2357 | GNUNET_SERVER_mst_receive (plugin->mst, &si, (const char *) &msg[1], | 2361 | GNUNET_SERVER_mst_receive (plugin->mst, |
2358 | ntohs (msg->header.size) - sizeof(struct UDPMessage), GNUNET_YES, | 2362 | &si, |
2359 | GNUNET_NO); | 2363 | (const char *) &msg[1], |
2364 | ntohs (msg->header.size) - sizeof(struct UDPMessage), | ||
2365 | GNUNET_YES, | ||
2366 | GNUNET_NO); | ||
2360 | s->rc--; | 2367 | s->rc--; |
2361 | if ((0 == s->rc) && (GNUNET_YES == s->in_destroy)) | 2368 | if ((0 == s->rc) && (GNUNET_YES == s->in_destroy)) |
2362 | free_session (s); | 2369 | free_session (s); |
@@ -3614,12 +3621,12 @@ libgnunet_plugin_transport_udp_done (void *cls) | |||
3614 | return NULL; | 3621 | return NULL; |
3615 | } | 3622 | } |
3616 | stop_broadcast (plugin); | 3623 | stop_broadcast (plugin); |
3617 | if (plugin->select_task != NULL ) | 3624 | if (plugin->select_task != NULL) |
3618 | { | 3625 | { |
3619 | GNUNET_SCHEDULER_cancel (plugin->select_task); | 3626 | GNUNET_SCHEDULER_cancel (plugin->select_task); |
3620 | plugin->select_task = NULL; | 3627 | plugin->select_task = NULL; |
3621 | } | 3628 | } |
3622 | if (plugin->select_task_v6 != NULL ) | 3629 | if (plugin->select_task_v6 != NULL) |
3623 | { | 3630 | { |
3624 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); | 3631 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); |
3625 | plugin->select_task_v6 = NULL; | 3632 | plugin->select_task_v6 = NULL; |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index b0be34346..51e8991b9 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1395,7 +1395,6 @@ process_data (void *cls, | |||
1395 | struct Plugin *plugin = cls; | 1395 | struct Plugin *plugin = cls; |
1396 | struct GNUNET_HELLO_Address *address; | 1396 | struct GNUNET_HELLO_Address *address; |
1397 | struct MacAndSession *mas = client; | 1397 | struct MacAndSession *mas = client; |
1398 | struct MacAndSession xmas; | ||
1399 | struct GNUNET_ATS_Information ats; | 1398 | struct GNUNET_ATS_Information ats; |
1400 | struct FragmentMessage *fm; | 1399 | struct FragmentMessage *fm; |
1401 | struct GNUNET_PeerIdentity tmpsource; | 1400 | struct GNUNET_PeerIdentity tmpsource; |
@@ -1448,6 +1447,17 @@ process_data (void *cls, | |||
1448 | &mas->endpoint->wlan_addr, | 1447 | &mas->endpoint->wlan_addr, |
1449 | sizeof (mas->endpoint->wlan_addr), | 1448 | sizeof (mas->endpoint->wlan_addr), |
1450 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | 1449 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); |
1450 | mas->session = lookup_session (mas->endpoint, | ||
1451 | &tmpsource); | ||
1452 | if (NULL == mas->session) | ||
1453 | { | ||
1454 | mas->session = create_session (mas->endpoint, | ||
1455 | &tmpsource); | ||
1456 | plugin->env->session_start (plugin->env->cls, | ||
1457 | address, | ||
1458 | mas->session, | ||
1459 | &ats, 1); | ||
1460 | } | ||
1451 | plugin->env->receive (plugin->env->cls, | 1461 | plugin->env->receive (plugin->env->cls, |
1452 | address, | 1462 | address, |
1453 | mas->session, | 1463 | mas->session, |
@@ -1557,34 +1567,34 @@ process_data (void *cls, | |||
1557 | GNUNET_NO); | 1567 | GNUNET_NO); |
1558 | break; | 1568 | break; |
1559 | } | 1569 | } |
1560 | xmas.endpoint = mas->endpoint; | 1570 | mas->session = lookup_session (mas->endpoint, |
1561 | if (NULL == (xmas.session = lookup_session (mas->endpoint, | 1571 | &wlanheader->sender); |
1562 | &wlanheader->sender))) | 1572 | if (NULL == mas->session) |
1563 | { | 1573 | { |
1564 | xmas.session = create_session (mas->endpoint, | 1574 | mas->session = create_session (mas->endpoint, |
1565 | &wlanheader->sender); | 1575 | &wlanheader->sender); |
1566 | address = GNUNET_HELLO_address_allocate (&wlanheader->sender, | 1576 | address = GNUNET_HELLO_address_allocate (&wlanheader->sender, |
1567 | PLUGIN_NAME, | 1577 | PLUGIN_NAME, |
1568 | &mas->endpoint->wlan_addr, | 1578 | &mas->endpoint->wlan_addr, |
1569 | sizeof (struct WlanAddress), | 1579 | sizeof (struct WlanAddress), |
1570 | GNUNET_HELLO_ADDRESS_INFO_NONE); | 1580 | GNUNET_HELLO_ADDRESS_INFO_NONE); |
1571 | plugin->env->session_start (NULL, | 1581 | plugin->env->session_start (plugin->env->cls, |
1572 | address, | 1582 | address, |
1573 | xmas.session, | 1583 | mas->session, |
1574 | NULL, 0); | 1584 | NULL, 0); |
1575 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1585 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1576 | "Notifying transport about peer `%s''s new session %p \n", | 1586 | "Notifying transport about peer `%s''s new session %p \n", |
1577 | GNUNET_i2s (&wlanheader->sender), | 1587 | GNUNET_i2s (&wlanheader->sender), |
1578 | xmas.session); | 1588 | mas->session); |
1579 | GNUNET_HELLO_address_free (address); | 1589 | GNUNET_HELLO_address_free (address); |
1580 | } | 1590 | } |
1581 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1591 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1582 | "Processing %u bytes of DATA from peer `%s'\n", | 1592 | "Processing %u bytes of DATA from peer `%s'\n", |
1583 | (unsigned int) msize, | 1593 | (unsigned int) msize, |
1584 | GNUNET_i2s (&wlanheader->sender)); | 1594 | GNUNET_i2s (&wlanheader->sender)); |
1585 | xmas.session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1595 | mas->session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1586 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, | 1596 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, |
1587 | &xmas, | 1597 | mas, |
1588 | (const char *) &wlanheader[1], | 1598 | (const char *) &wlanheader[1], |
1589 | msize - sizeof (struct WlanHeader), | 1599 | msize - sizeof (struct WlanHeader), |
1590 | GNUNET_YES, | 1600 | GNUNET_YES, |
@@ -2188,9 +2198,12 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
2188 | GNUNET_BANDWIDTH_value_init (100 * 1024 * | 2198 | GNUNET_BANDWIDTH_value_init (100 * 1024 * |
2189 | 1024 / 8), | 2199 | 1024 / 8), |
2190 | 100); | 2200 | 100); |
2191 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2201 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, |
2192 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2202 | plugin); |
2193 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2203 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, |
2204 | plugin); | ||
2205 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, | ||
2206 | plugin); | ||
2194 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, | 2207 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, |
2195 | plugin); | 2208 | plugin); |
2196 | 2209 | ||
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index a727d3e6a..903e6efdc 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -87,22 +87,22 @@ static int ok; | |||
87 | /** | 87 | /** |
88 | * Context of peer 1 | 88 | * Context of peer 1 |
89 | */ | 89 | */ |
90 | struct PeerContext *p1; | 90 | static struct PeerContext *p1; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Configuration file of peer 1 | 93 | * Configuration file of peer 1 |
94 | */ | 94 | */ |
95 | char *cfg_file_p1; | 95 | static char *cfg_file_p1; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Context of peer 2 | 98 | * Context of peer 2 |
99 | */ | 99 | */ |
100 | struct PeerContext *p2; | 100 | static struct PeerContext *p2; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Configuration file of peer 1 | 103 | * Configuration file of peer 1 |
104 | */ | 104 | */ |
105 | char *cfg_file_p2; | 105 | static char *cfg_file_p2; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Timeout task | 108 | * Timeout task |
@@ -112,12 +112,12 @@ static struct GNUNET_SCHEDULER_Task * die_task; | |||
112 | /** | 112 | /** |
113 | * Transport transmit handle used | 113 | * Transport transmit handle used |
114 | */ | 114 | */ |
115 | struct GNUNET_TRANSPORT_TransmitHandle *th; | 115 | static struct GNUNET_TRANSPORT_TransmitHandle *th; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Transport testing handle | 118 | * Transport testing handle |
119 | */ | 119 | */ |
120 | struct GNUNET_TRANSPORT_TESTING_handle *tth; | 120 | static struct GNUNET_TRANSPORT_TESTING_handle *tth; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Total amount of bytes sent | 123 | * Total amount of bytes sent |
@@ -145,7 +145,9 @@ static int msg_sent; | |||
145 | static int msg_recv; | 145 | static int msg_recv; |
146 | 146 | ||
147 | static int test_connected; | 147 | static int test_connected; |
148 | |||
148 | static int test_sending; | 149 | static int test_sending; |
150 | |||
149 | static int test_send_timeout; | 151 | static int test_send_timeout; |
150 | 152 | ||
151 | 153 | ||
@@ -167,9 +169,11 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; | |||
167 | #define OKPP do { ok++; } while (0) | 169 | #define OKPP do { ok++; } while (0) |
168 | #endif | 170 | #endif |
169 | 171 | ||
172 | |||
170 | static int | 173 | static int |
171 | get_bit (const char *map, unsigned int bit); | 174 | get_bit (const char *map, unsigned int bit); |
172 | 175 | ||
176 | |||
173 | static void | 177 | static void |
174 | end () | 178 | end () |
175 | { | 179 | { |