diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-18 11:31:56 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-18 11:31:56 +0000 |
commit | 7dd5cd13dd34be6a6ba90e586f599cfada951648 (patch) | |
tree | ad099f24b7521ba33ac8e27d0b8d44ddec509f67 | |
parent | 0e5752c4c3a0a3a76c5d434be10fab4613835bda (diff) | |
download | gnunet-7dd5cd13dd34be6a6ba90e586f599cfada951648.tar.gz gnunet-7dd5cd13dd34be6a6ba90e586f599cfada951648.zip |
new timeout function and keep alives with nonces
-rw-r--r-- | src/transport/gnunet-service-transport.c | 4 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 124 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.h | 17 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_plugins.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_bluetooth.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 9 | ||||
-rw-r--r-- | src/transport/plugin_transport_template.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 9 | ||||
-rw-r--r-- | src/transport/plugin_transport_unix.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 9 |
12 files changed, 201 insertions, 23 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 4a22b45e8..1f8ffd5bc 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -384,10 +384,10 @@ GST_receive_callback (void *cls, | |||
384 | GST_neighbours_handle_disconnect_message (peer, message); | 384 | GST_neighbours_handle_disconnect_message (peer, message); |
385 | break; | 385 | break; |
386 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE: | 386 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE: |
387 | GST_neighbours_keepalive (peer); | 387 | GST_neighbours_keepalive (peer, message); |
388 | break; | 388 | break; |
389 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE: | 389 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE: |
390 | GST_neighbours_keepalive_response (peer); | 390 | GST_neighbours_keepalive_response (peer, message); |
391 | break; | 391 | break; |
392 | default: | 392 | default: |
393 | /* should be payload */ | 393 | /* should be payload */ |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index c4d4677b1..e5bc5161c 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -117,6 +117,28 @@ struct SessionConnectMessage | |||
117 | 117 | ||
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Message a peer sends to another when connected to indicate that a | ||
121 | * session is in use and the peer is still alive or to respond to a keep alive. | ||
122 | * A peer sends a message with type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE | ||
123 | * to request a message with #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE. | ||
124 | * When the keep alive response with type is received, transport service | ||
125 | * will call the respective plugin to update the session timeout | ||
126 | */ | ||
127 | struct SessionKeepAliveMessage | ||
128 | { | ||
129 | /** | ||
130 | * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE or | ||
131 | * #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE. | ||
132 | */ | ||
133 | struct GNUNET_MessageHeader header; | ||
134 | |||
135 | /** | ||
136 | * A nonce to identify the session the keep alive is used for | ||
137 | */ | ||
138 | uint32_t nonce GNUNET_PACKED; | ||
139 | }; | ||
140 | |||
141 | /** | ||
120 | * Message we send to the other peer to notify him that we intentionally | 142 | * Message we send to the other peer to notify him that we intentionally |
121 | * are disconnecting (to reduce timeouts). This is just a friendly | 143 | * are disconnecting (to reduce timeouts). This is just a friendly |
122 | * notification, peers must not rely on always receiving disconnect | 144 | * notification, peers must not rely on always receiving disconnect |
@@ -410,6 +432,10 @@ struct NeighbourAddress | |||
410 | */ | 432 | */ |
411 | int ats_active; | 433 | int ats_active; |
412 | 434 | ||
435 | /** | ||
436 | * The current nonce sent in the last keep alive messages | ||
437 | */ | ||
438 | uint32_t keep_alive_nonce; | ||
413 | }; | 439 | }; |
414 | 440 | ||
415 | 441 | ||
@@ -775,6 +801,7 @@ free_address (struct NeighbourAddress *na) | |||
775 | } | 801 | } |
776 | 802 | ||
777 | na->ats_active = GNUNET_NO; | 803 | na->ats_active = GNUNET_NO; |
804 | na->keep_alive_nonce = 0; | ||
778 | if (NULL != na->address) | 805 | if (NULL != na->address) |
779 | { | 806 | { |
780 | GNUNET_HELLO_address_free (na->address); | 807 | GNUNET_HELLO_address_free (na->address); |
@@ -847,6 +874,7 @@ set_address (struct NeighbourAddress *na, | |||
847 | na->bandwidth_out = bandwidth_out; | 874 | na->bandwidth_out = bandwidth_out; |
848 | na->session = session; | 875 | na->session = session; |
849 | na->ats_active = is_active; | 876 | na->ats_active = is_active; |
877 | na->keep_alive_nonce = 0; | ||
850 | if (GNUNET_YES == is_active) | 878 | if (GNUNET_YES == is_active) |
851 | { | 879 | { |
852 | /* Telling ATS about new session */ | 880 | /* Telling ATS about new session */ |
@@ -1296,16 +1324,28 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) | |||
1296 | static void | 1324 | static void |
1297 | send_keepalive (struct NeighbourMapEntry *n) | 1325 | send_keepalive (struct NeighbourMapEntry *n) |
1298 | { | 1326 | { |
1299 | struct GNUNET_MessageHeader m; | 1327 | struct SessionKeepAliveMessage m; |
1300 | struct GNUNET_TIME_Relative timeout; | 1328 | struct GNUNET_TIME_Relative timeout; |
1329 | uint32_t nonce; | ||
1301 | 1330 | ||
1302 | GNUNET_assert ((S_CONNECTED == n->state) || | 1331 | GNUNET_assert ((S_CONNECTED == n->state) || |
1303 | (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || | 1332 | (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || |
1304 | (S_CONNECTED_SWITCHING_CONNECT_SENT)); | 1333 | (S_CONNECTED_SWITCHING_CONNECT_SENT)); |
1305 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0) | 1334 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0) |
1306 | return; /* no keepalive needed at this time */ | 1335 | return; /* no keepalive needed at this time */ |
1307 | m.size = htons (sizeof (struct GNUNET_MessageHeader)); | 1336 | |
1308 | m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); | 1337 | nonce = 0; /* 0 indicates 'not set' */ |
1338 | while (0 == nonce) | ||
1339 | nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | ||
1340 | |||
1341 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1342 | "Sending keep alive response to peer `%s' with nonce %u\n", | ||
1343 | GNUNET_i2s (&n->id), nonce); | ||
1344 | |||
1345 | m.header.size = htons (sizeof (struct SessionKeepAliveMessage)); | ||
1346 | m.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); | ||
1347 | m.nonce = htonl (nonce); | ||
1348 | |||
1309 | timeout = send_with_session (n, | 1349 | timeout = send_with_session (n, |
1310 | (const void *) &m, sizeof (m), | 1350 | (const void *) &m, sizeof (m), |
1311 | UINT32_MAX /* priority */, | 1351 | UINT32_MAX /* priority */, |
@@ -1313,9 +1353,11 @@ send_keepalive (struct NeighbourMapEntry *n) | |||
1313 | NULL, NULL); | 1353 | NULL, NULL); |
1314 | GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1, | 1354 | GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1, |
1315 | GNUNET_NO); | 1355 | GNUNET_NO); |
1356 | n->primary_address.keep_alive_nonce = nonce; | ||
1316 | n->expect_latency_response = GNUNET_YES; | 1357 | n->expect_latency_response = GNUNET_YES; |
1317 | n->last_keep_alive_time = GNUNET_TIME_absolute_get (); | 1358 | n->last_keep_alive_time = GNUNET_TIME_absolute_get (); |
1318 | n->keep_alive_time = GNUNET_TIME_relative_to_absolute (timeout); | 1359 | n->keep_alive_time = GNUNET_TIME_relative_to_absolute (timeout); |
1360 | |||
1319 | } | 1361 | } |
1320 | 1362 | ||
1321 | 1363 | ||
@@ -1324,13 +1366,20 @@ send_keepalive (struct NeighbourMapEntry *n) | |||
1324 | * we received a KEEPALIVE (or equivalent); send a response. | 1366 | * we received a KEEPALIVE (or equivalent); send a response. |
1325 | * | 1367 | * |
1326 | * @param neighbour neighbour to keep alive (by sending keep alive response) | 1368 | * @param neighbour neighbour to keep alive (by sending keep alive response) |
1369 | * @param m the keep alive message containing the nonce to respond to | ||
1327 | */ | 1370 | */ |
1328 | void | 1371 | void |
1329 | GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour) | 1372 | GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour, |
1373 | const struct GNUNET_MessageHeader *m) | ||
1330 | { | 1374 | { |
1331 | struct NeighbourMapEntry *n; | 1375 | struct NeighbourMapEntry *n; |
1332 | struct GNUNET_MessageHeader m; | 1376 | const struct SessionKeepAliveMessage *msg_in; |
1377 | struct SessionKeepAliveMessage msg; | ||
1333 | 1378 | ||
1379 | if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) | ||
1380 | return; | ||
1381 | |||
1382 | msg_in = (struct SessionKeepAliveMessage *) m; | ||
1334 | if (NULL == (n = lookup_neighbour (neighbour))) | 1383 | if (NULL == (n = lookup_neighbour (neighbour))) |
1335 | { | 1384 | { |
1336 | GNUNET_STATISTICS_update (GST_stats, | 1385 | GNUNET_STATISTICS_update (GST_stats, |
@@ -1347,11 +1396,17 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour) | |||
1347 | 1, GNUNET_NO); | 1396 | 1, GNUNET_NO); |
1348 | return; | 1397 | return; |
1349 | } | 1398 | } |
1399 | |||
1400 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1401 | "Received keep alive request from peer `%s' with nonce %u\n", | ||
1402 | GNUNET_i2s (&n->id), ntohl (msg_in->nonce)); | ||
1403 | |||
1350 | /* send reply to allow neighbour to measure latency */ | 1404 | /* send reply to allow neighbour to measure latency */ |
1351 | m.size = htons (sizeof (struct GNUNET_MessageHeader)); | 1405 | msg.header.size = htons (sizeof (struct SessionKeepAliveMessage)); |
1352 | m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE); | 1406 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE); |
1407 | msg.nonce = msg_in->nonce; | ||
1353 | (void) send_with_session(n, | 1408 | (void) send_with_session(n, |
1354 | (const void *) &m, sizeof (m), | 1409 | (const void *) &msg, sizeof (struct SessionKeepAliveMessage), |
1355 | UINT32_MAX /* priority */, | 1410 | UINT32_MAX /* priority */, |
1356 | GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, | 1411 | GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, |
1357 | NULL, NULL); | 1412 | NULL, NULL); |
@@ -1364,14 +1419,22 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour) | |||
1364 | * plus calculated latency) to ATS. | 1419 | * plus calculated latency) to ATS. |
1365 | * | 1420 | * |
1366 | * @param neighbour neighbour to keep alive | 1421 | * @param neighbour neighbour to keep alive |
1422 | * @param m the message containing the keep alive response | ||
1367 | */ | 1423 | */ |
1368 | void | 1424 | void |
1369 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) | 1425 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, |
1426 | const struct GNUNET_MessageHeader *m) | ||
1370 | { | 1427 | { |
1371 | struct NeighbourMapEntry *n; | 1428 | struct NeighbourMapEntry *n; |
1429 | const struct SessionKeepAliveMessage *msg; | ||
1430 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | ||
1372 | uint32_t latency; | 1431 | uint32_t latency; |
1373 | struct GNUNET_ATS_Information ats; | 1432 | struct GNUNET_ATS_Information ats; |
1374 | 1433 | ||
1434 | if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) | ||
1435 | return; | ||
1436 | |||
1437 | msg = (const struct SessionKeepAliveMessage *) m; | ||
1375 | if (NULL == (n = lookup_neighbour (neighbour))) | 1438 | if (NULL == (n = lookup_neighbour (neighbour))) |
1376 | { | 1439 | { |
1377 | GNUNET_STATISTICS_update (GST_stats, | 1440 | GNUNET_STATISTICS_update (GST_stats, |
@@ -1389,6 +1452,43 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) | |||
1389 | 1, GNUNET_NO); | 1452 | 1, GNUNET_NO); |
1390 | return; | 1453 | return; |
1391 | } | 1454 | } |
1455 | if (NULL == n->primary_address.address) | ||
1456 | { | ||
1457 | GNUNET_STATISTICS_update (GST_stats, | ||
1458 | gettext_noop | ||
1459 | ("# KEEPALIVE_RESPONSE messages discarded (address changed)"), | ||
1460 | 1, GNUNET_NO); | ||
1461 | return; | ||
1462 | } | ||
1463 | if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce)) | ||
1464 | { | ||
1465 | GNUNET_STATISTICS_update (GST_stats, | ||
1466 | gettext_noop | ||
1467 | ("# KEEPALIVE_RESPONSE messages discarded (wrong nonce)"), | ||
1468 | 1, GNUNET_NO); | ||
1469 | return; | ||
1470 | } | ||
1471 | else | ||
1472 | { | ||
1473 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1474 | "Received keep alive response from peer `%s' for session %p\n", | ||
1475 | GNUNET_i2s (&n->id), n->primary_address.session); | ||
1476 | |||
1477 | } | ||
1478 | |||
1479 | /* Update session timeout here */ | ||
1480 | if (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name))) | ||
1481 | { | ||
1482 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1483 | "Updating session for peer `%s' for session %p\n", | ||
1484 | GNUNET_i2s (&n->id), n->primary_address.session); | ||
1485 | papi->update_session_timeout (papi->cls, &n->id, n->primary_address.session); | ||
1486 | } | ||
1487 | else | ||
1488 | { | ||
1489 | GNUNET_break (0); | ||
1490 | } | ||
1491 | |||
1392 | n->expect_latency_response = GNUNET_NO; | 1492 | n->expect_latency_response = GNUNET_NO; |
1393 | n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time); | 1493 | n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time); |
1394 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1494 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
@@ -1404,10 +1504,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) | |||
1404 | else | 1504 | else |
1405 | latency = n->latency.rel_value_us; | 1505 | latency = n->latency.rel_value_us; |
1406 | ats.value = htonl (latency); | 1506 | ats.value = htonl (latency); |
1407 | GST_ats_update_metrics (&n->id, | 1507 | GST_ats_update_metrics (&n->id, n->primary_address.address, |
1408 | n->primary_address.address, | 1508 | n->primary_address.session, &ats, 1); |
1409 | n->primary_address.session, | ||
1410 | &ats, 1); | ||
1411 | } | 1509 | } |
1412 | 1510 | ||
1413 | 1511 | ||
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h index f58a74faf..b5abcf5da 100644 --- a/src/transport/gnunet-service-transport_neighbours.h +++ b/src/transport/gnunet-service-transport_neighbours.h | |||
@@ -125,22 +125,27 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity | |||
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Keep the connection to the given neighbour alive longer, | 127 | * Keep the connection to the given neighbour alive longer, |
128 | * we received a KEEPALIVE (or equivalent). | 128 | * we received a KEEPALIVE (or equivalent); send a response. |
129 | * | 129 | * |
130 | * @param neighbour neighbour to keep alive | 130 | * @param neighbour neighbour to keep alive (by sending keep alive response) |
131 | * @param m the keep alive message containing the nonce to respond to | ||
131 | */ | 132 | */ |
132 | void | 133 | void |
133 | GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour); | 134 | GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour, |
135 | const struct GNUNET_MessageHeader *m); | ||
134 | 136 | ||
135 | 137 | ||
136 | /** | 138 | /** |
137 | * We received a KEEP_ALIVE_RESPONSE message and use this to calculate latency | 139 | * We received a KEEP_ALIVE_RESPONSE message and use this to calculate |
138 | * to this peer | 140 | * latency to this peer. Pass the updated information (existing ats |
141 | * plus calculated latency) to ATS. | ||
139 | * | 142 | * |
140 | * @param neighbour neighbour to keep alive | 143 | * @param neighbour neighbour to keep alive |
144 | * @param m the message containing the keep alive response | ||
141 | */ | 145 | */ |
142 | void | 146 | void |
143 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour); | 147 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, |
148 | const struct GNUNET_MessageHeader *m); | ||
144 | 149 | ||
145 | 150 | ||
146 | /** | 151 | /** |
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c index 8df133046..865b5dd19 100644 --- a/src/transport/gnunet-service-transport_plugins.c +++ b/src/transport/gnunet-service-transport_plugins.c | |||
@@ -245,6 +245,14 @@ GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, | |||
245 | "query_keepalive_factor", | 245 | "query_keepalive_factor", |
246 | plug->lib_name); | 246 | plug->lib_name); |
247 | } | 247 | } |
248 | if (NULL == plug->api->update_session_timeout) | ||
249 | { | ||
250 | fail = GNUNET_YES; | ||
251 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
252 | _("Missing function `%s' in transport plugin for `%s'\n"), | ||
253 | "update_session_timeout", | ||
254 | plug->lib_name); | ||
255 | } | ||
248 | if (GNUNET_YES == fail) | 256 | if (GNUNET_YES == fail) |
249 | { | 257 | { |
250 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 258 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c index 7fbdbcfa9..bdc5a9fee 100644 --- a/src/transport/plugin_transport_bluetooth.c +++ b/src/transport/plugin_transport_bluetooth.c | |||
@@ -1799,6 +1799,15 @@ bluetooth_string_to_address (void *cls, const char *addr, uint16_t addrlen, | |||
1799 | return GNUNET_OK; | 1799 | return GNUNET_OK; |
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | static void | ||
1803 | bluetooth_plugin_update_session_timeout (void *cls, | ||
1804 | const struct GNUNET_PeerIdentity *peer, | ||
1805 | struct Session *session) | ||
1806 | { | ||
1807 | |||
1808 | } | ||
1809 | |||
1810 | |||
1802 | 1811 | ||
1803 | /** | 1812 | /** |
1804 | * Entry point for the plugin. | 1813 | * Entry point for the plugin. |
@@ -1933,6 +1942,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) | |||
1933 | api->address_to_string = &bluetooth_plugin_address_to_string;; | 1942 | api->address_to_string = &bluetooth_plugin_address_to_string;; |
1934 | api->string_to_address = &bluetooth_string_to_address; | 1943 | api->string_to_address = &bluetooth_string_to_address; |
1935 | api->get_network = &bluetooth_get_network; | 1944 | api->get_network = &bluetooth_get_network; |
1945 | api->update_session_timeout = &blueooth_plugin_update_session_timeout; | ||
1936 | 1946 | ||
1937 | return api; | 1947 | return api; |
1938 | } | 1948 | } |
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index b2bb5d513..504cf48ff 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -1759,6 +1759,13 @@ http_plugin_address_to_string (void *cls, | |||
1759 | return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen); | 1759 | return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | static void | ||
1763 | http_client_plugin_update_session_timeout (void *cls, | ||
1764 | const struct GNUNET_PeerIdentity *peer, | ||
1765 | struct Session *session) | ||
1766 | { | ||
1767 | |||
1768 | } | ||
1762 | 1769 | ||
1763 | /** | 1770 | /** |
1764 | * Entry point for the plugin. | 1771 | * Entry point for the plugin. |
@@ -1796,6 +1803,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
1796 | api->string_to_address = &http_common_plugin_string_to_address; | 1803 | api->string_to_address = &http_common_plugin_string_to_address; |
1797 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; | 1804 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; |
1798 | api->get_network = &http_client_get_network; | 1805 | api->get_network = &http_client_get_network; |
1806 | api->update_session_timeout = &http_client_plugin_update_session_timeout; | ||
1799 | 1807 | ||
1800 | #if BUILD_HTTPS | 1808 | #if BUILD_HTTPS |
1801 | plugin->name = "transport-https_client"; | 1809 | plugin->name = "transport-https_client"; |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 19fd632b8..5d529b4ed 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -900,6 +900,14 @@ http_server_query_keepalive_factor (void *cls) | |||
900 | return 3; | 900 | return 3; |
901 | } | 901 | } |
902 | 902 | ||
903 | static void | ||
904 | http_server_plugin_update_session_timeout (void *cls, | ||
905 | const struct GNUNET_PeerIdentity *peer, | ||
906 | struct Session *session) | ||
907 | { | ||
908 | |||
909 | } | ||
910 | |||
903 | 911 | ||
904 | /** | 912 | /** |
905 | * Tell MHD that the connection should timeout after @a to seconds. | 913 | * Tell MHD that the connection should timeout after @a to seconds. |
@@ -3121,7 +3129,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
3121 | api->string_to_address = &http_common_plugin_string_to_address; | 3129 | api->string_to_address = &http_common_plugin_string_to_address; |
3122 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; | 3130 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; |
3123 | api->get_network = &http_server_get_network; | 3131 | api->get_network = &http_server_get_network; |
3124 | 3132 | api->update_session_timeout = &http_server_plugin_update_session_timeout; | |
3125 | #if BUILD_HTTPS | 3133 | #if BUILD_HTTPS |
3126 | plugin->name = "transport-https_server"; | 3134 | plugin->name = "transport-https_server"; |
3127 | plugin->protocol = "https"; | 3135 | plugin->protocol = "https"; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 992729911..f2db47922 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1420,6 +1420,14 @@ nat_connect_timeout (void *cls, | |||
1420 | session); | 1420 | session); |
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | static void | ||
1424 | tcp_plugin_update_session_timeout (void *cls, | ||
1425 | const struct GNUNET_PeerIdentity *peer, | ||
1426 | struct Session *session) | ||
1427 | { | ||
1428 | |||
1429 | } | ||
1430 | |||
1423 | 1431 | ||
1424 | /** | 1432 | /** |
1425 | * Create a new session to transmit data to the target | 1433 | * Create a new session to transmit data to the target |
@@ -2687,6 +2695,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2687 | api->address_to_string = &tcp_address_to_string; | 2695 | api->address_to_string = &tcp_address_to_string; |
2688 | api->string_to_address = &tcp_string_to_address; | 2696 | api->string_to_address = &tcp_string_to_address; |
2689 | api->get_network = &tcp_get_network; | 2697 | api->get_network = &tcp_get_network; |
2698 | api->update_session_timeout = &tcp_plugin_update_session_timeout; | ||
2690 | plugin->service = service; | 2699 | plugin->service = service; |
2691 | if (NULL != service) | 2700 | if (NULL != service) |
2692 | { | 2701 | { |
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index abcae5111..f39db3e79 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c | |||
@@ -378,6 +378,13 @@ template_plugin_get_session (void *cls, | |||
378 | return NULL; | 378 | return NULL; |
379 | } | 379 | } |
380 | 380 | ||
381 | static void | ||
382 | template_plugin_update_session_timeout (void *cls, | ||
383 | const struct GNUNET_PeerIdentity *peer, | ||
384 | struct Session *session) | ||
385 | { | ||
386 | |||
387 | } | ||
381 | 388 | ||
382 | /** | 389 | /** |
383 | * Entry point for the plugin. | 390 | * Entry point for the plugin. |
@@ -415,6 +422,7 @@ libgnunet_plugin_transport_template_init (void *cls) | |||
415 | api->string_to_address = &template_plugin_string_to_address; | 422 | api->string_to_address = &template_plugin_string_to_address; |
416 | api->get_session = &template_plugin_get_session; | 423 | api->get_session = &template_plugin_get_session; |
417 | api->get_network = &template_plugin_get_network; | 424 | api->get_network = &template_plugin_get_network; |
425 | api->update_session_timeout = &template_plugin_update_session_timeout; | ||
418 | LOG (GNUNET_ERROR_TYPE_INFO, "Template plugin successfully loaded\n"); | 426 | LOG (GNUNET_ERROR_TYPE_INFO, "Template plugin successfully loaded\n"); |
419 | return api; | 427 | return api; |
420 | } | 428 | } |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 1ba5bff6c..4480747a5 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1673,6 +1673,13 @@ udp_plugin_create_session (void *cls, | |||
1673 | return s; | 1673 | return s; |
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | static void | ||
1677 | udp_plugin_update_session_timeout (void *cls, | ||
1678 | const struct GNUNET_PeerIdentity *peer, | ||
1679 | struct Session *session) | ||
1680 | { | ||
1681 | |||
1682 | } | ||
1676 | 1683 | ||
1677 | /** | 1684 | /** |
1678 | * Creates a new outbound session the transport service will use to send data to the | 1685 | * Creates a new outbound session the transport service will use to send data to the |
@@ -3197,7 +3204,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3197 | api->get_session = &udp_plugin_get_session; | 3204 | api->get_session = &udp_plugin_get_session; |
3198 | api->send = &udp_plugin_send; | 3205 | api->send = &udp_plugin_send; |
3199 | api->get_network = &udp_get_network; | 3206 | api->get_network = &udp_get_network; |
3200 | 3207 | api->update_session_timeout = &udp_plugin_update_session_timeout; | |
3201 | return api; | 3208 | return api; |
3202 | } | 3209 | } |
3203 | 3210 | ||
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 906cf9997..67c176633 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -906,6 +906,13 @@ unix_plugin_get_session (void *cls, | |||
906 | return s; | 906 | return s; |
907 | } | 907 | } |
908 | 908 | ||
909 | static void | ||
910 | unix_plugin_update_session_timeout (void *cls, | ||
911 | const struct GNUNET_PeerIdentity *peer, | ||
912 | struct Session *session) | ||
913 | { | ||
914 | |||
915 | } | ||
909 | 916 | ||
910 | /** | 917 | /** |
911 | * Function that can be used by the transport service to transmit | 918 | * Function that can be used by the transport service to transmit |
@@ -1635,6 +1642,7 @@ libgnunet_plugin_transport_unix_init (void *cls) | |||
1635 | api->check_address = &unix_check_address; | 1642 | api->check_address = &unix_check_address; |
1636 | api->string_to_address = &unix_string_to_address; | 1643 | api->string_to_address = &unix_string_to_address; |
1637 | api->get_network = &unix_get_network; | 1644 | api->get_network = &unix_get_network; |
1645 | api->update_session_timeout = &unix_plugin_update_session_timeout; | ||
1638 | sockets_created = unix_transport_server_start (plugin); | 1646 | sockets_created = unix_transport_server_start (plugin); |
1639 | if (0 == sockets_created) | 1647 | if (0 == sockets_created) |
1640 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1648 | LOG (GNUNET_ERROR_TYPE_WARNING, |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 916998dcc..212394248 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1856,6 +1856,14 @@ wlan_string_to_address (void *cls, const char *addr, uint16_t addrlen, | |||
1856 | } | 1856 | } |
1857 | 1857 | ||
1858 | 1858 | ||
1859 | static void | ||
1860 | wlan_plugin_update_session_timeout (void *cls, | ||
1861 | const struct GNUNET_PeerIdentity *peer, | ||
1862 | struct Session *session) | ||
1863 | { | ||
1864 | |||
1865 | } | ||
1866 | |||
1859 | /** | 1867 | /** |
1860 | * Entry point for the plugin. | 1868 | * Entry point for the plugin. |
1861 | * | 1869 | * |
@@ -1989,6 +1997,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1989 | api->address_to_string = &wlan_plugin_address_to_string; | 1997 | api->address_to_string = &wlan_plugin_address_to_string; |
1990 | api->string_to_address = &wlan_string_to_address; | 1998 | api->string_to_address = &wlan_string_to_address; |
1991 | api->get_network = &wlan_get_network; | 1999 | api->get_network = &wlan_get_network; |
2000 | api->update_session_timeout = &wlan_plugin_update_session_timeout; | ||
1992 | return api; | 2001 | return api; |
1993 | } | 2002 | } |
1994 | 2003 | ||