diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 50 | ||||
-rw-r--r-- | src/transport/plugin_transport_http.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 3 |
3 files changed, 51 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index a61d9d371..e46eb8ea3 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1363,7 +1363,8 @@ send_connect_ack_continuation (void *cls, | |||
1363 | int | 1363 | int |
1364 | GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer, | 1364 | GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer, |
1365 | const struct GNUNET_HELLO_Address | 1365 | const struct GNUNET_HELLO_Address |
1366 | *address, struct Session *session, | 1366 | *address, |
1367 | struct Session *session, | ||
1367 | const struct GNUNET_ATS_Information *ats, | 1368 | const struct GNUNET_ATS_Information *ats, |
1368 | uint32_t ats_count, | 1369 | uint32_t ats_count, |
1369 | struct GNUNET_BANDWIDTH_Value32NBO | 1370 | struct GNUNET_BANDWIDTH_Value32NBO |
@@ -1442,13 +1443,58 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer, | |||
1442 | GNUNET_HELLO_address_free (n->address); | 1443 | GNUNET_HELLO_address_free (n->address); |
1443 | n->address = GNUNET_HELLO_address_copy (address); | 1444 | n->address = GNUNET_HELLO_address_copy (address); |
1444 | n->address_state = FRESH; | 1445 | n->address_state = FRESH; |
1445 | n->session = session; | ||
1446 | n->bandwidth_in = bandwidth_in; | 1446 | n->bandwidth_in = bandwidth_in; |
1447 | n->bandwidth_out = bandwidth_out; | 1447 | n->bandwidth_out = bandwidth_out; |
1448 | GNUNET_SCHEDULER_cancel (n->timeout_task); | 1448 | GNUNET_SCHEDULER_cancel (n->timeout_task); |
1449 | n->timeout_task = | 1449 | n->timeout_task = |
1450 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | 1450 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
1451 | &neighbour_timeout_task, n); | 1451 | &neighbour_timeout_task, n); |
1452 | |||
1453 | #if TEST_NEW_CODE | ||
1454 | /* Obtain an session for this address from plugin */ | ||
1455 | papi = GST_plugins_find (address->transport_name); | ||
1456 | GNUNET_assert (papi != NULL); | ||
1457 | if (session == NULL) | ||
1458 | { | ||
1459 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | ||
1460 | n->session = papi->get_session (papi->cls, address); | ||
1461 | /* Session could not be initiated */ | ||
1462 | if (n->session == NULL) | ||
1463 | { | ||
1464 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1465 | "Failed to obtain new session %p for peer `%s' and address '%s'\n", | ||
1466 | n->session, GNUNET_i2s (&n->id), GST_plugins_a2s (n->address)); | ||
1467 | |||
1468 | GNUNET_ATS_address_destroyed (GST_ats, n->address, NULL); | ||
1469 | |||
1470 | if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK) | ||
1471 | GNUNET_SCHEDULER_cancel (n->ats_suggest); | ||
1472 | n->ats_suggest = GNUNET_SCHEDULER_add_delayed (ATS_RESPONSE_TIMEOUT, | ||
1473 | ats_suggest_cancel, | ||
1474 | n); | ||
1475 | GNUNET_ATS_suggest_address (GST_ats, &n->id); | ||
1476 | GNUNET_HELLO_address_free (n->address); | ||
1477 | n->address = NULL; | ||
1478 | return GNUNET_NO; | ||
1479 | } | ||
1480 | else | ||
1481 | { | ||
1482 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1483 | "Obtained new session %p for peer `%s' and address '%s'\n", | ||
1484 | n->session, GNUNET_i2s (&n->id), GST_plugins_a2s (n->address)); | ||
1485 | } | ||
1486 | } | ||
1487 | else | ||
1488 | { | ||
1489 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1490 | "Using existing session %p for peer `%s' and address '%s'\n", | ||
1491 | n->session, GNUNET_i2s (&n->id), GST_plugins_a2s (n->address)); | ||
1492 | n->session = session; | ||
1493 | } | ||
1494 | #else | ||
1495 | n->session = session; | ||
1496 | #endif | ||
1497 | |||
1452 | switch (n->state) | 1498 | switch (n->state) |
1453 | { | 1499 | { |
1454 | case S_NOT_CONNECTED: | 1500 | case S_NOT_CONNECTED: |
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index ecf32c943..f4729811c 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -540,7 +540,7 @@ notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
540 | * @return the session or NULL of max connections exceeded | 540 | * @return the session or NULL of max connections exceeded |
541 | */ | 541 | */ |
542 | 542 | ||
543 | static const struct Session * | 543 | static struct Session * |
544 | http_get_session (void *cls, | 544 | http_get_session (void *cls, |
545 | const struct GNUNET_HELLO_Address *address) | 545 | const struct GNUNET_HELLO_Address *address) |
546 | { | 546 | { |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 19bf8d304..625747585 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1305,7 +1305,8 @@ int session_it (void *cls, | |||
1305 | * @param addrlen length of addr | 1305 | * @param addrlen length of addr |
1306 | * @return the session if the address is valid, NULL otherwise | 1306 | * @return the session if the address is valid, NULL otherwise |
1307 | */ | 1307 | */ |
1308 | const const struct Session * tcp_plugin_create_session (void *cls, | 1308 | static struct Session * |
1309 | tcp_plugin_create_session (void *cls, | ||
1309 | const struct GNUNET_HELLO_Address *address) | 1310 | const struct GNUNET_HELLO_Address *address) |
1310 | { | 1311 | { |
1311 | struct Plugin * plugin = cls; | 1312 | struct Plugin * plugin = cls; |