aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-15 01:56:00 +0000
committerLRN <lrn1986@gmail.com>2013-12-15 01:56:00 +0000
commit4e67f0c94b70b5c84502080485fee34d546a76cf (patch)
tree98e9aa18e390910831e8212c2bccc3641b02f23e
parent5d8f6a7b2711cbabb7bd2d0104da03e2f67b4fd8 (diff)
downloadgnunet-4e67f0c94b70b5c84502080485fee34d546a76cf.tar.gz
gnunet-4e67f0c94b70b5c84502080485fee34d546a76cf.zip
Non-uniform keepalive timeout for different plugins
-rw-r--r--src/include/gnunet_transport_plugin.h18
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c63
-rw-r--r--src/transport/plugin_transport_bluetooth.c16
-rw-r--r--src/transport/plugin_transport_http_client.c16
-rw-r--r--src/transport/plugin_transport_http_server.c16
-rw-r--r--src/transport/plugin_transport_tcp.c16
-rw-r--r--src/transport/plugin_transport_template.c16
-rw-r--r--src/transport/plugin_transport_udp.c16
-rw-r--r--src/transport/plugin_transport_unix.c16
-rw-r--r--src/transport/plugin_transport_wlan.c16
10 files changed, 178 insertions, 31 deletions
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h
index 6bf365243..f05048e96 100644
--- a/src/include/gnunet_transport_plugin.h
+++ b/src/include/gnunet_transport_plugin.h
@@ -390,6 +390,17 @@ typedef int
390(*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls, 390(*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls,
391 struct Session *session); 391 struct Session *session);
392 392
393/**
394 * Function that is called to get the keepalive factor.
395 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
396 * calculate the interval between keepalive packets.
397 *
398 * @param cls closure with the `struct Plugin`
399 * @return keepalive factor
400 */
401typedef unsigned int
402(*GNUNET_TRANSPORT_QueryKeepaliveFactorFunction) (void *cls);
403
393 404
394/** 405/**
395 * Function that can be called to force a disconnect from the 406 * Function that can be called to force a disconnect from the
@@ -565,6 +576,13 @@ struct GNUNET_TRANSPORT_PluginFunctions
565 GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session; 576 GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session;
566 577
567 /** 578 /**
579 * Function that is used to query keepalive factor.
580 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
581 * calculate the interval between keepalive packets.
582 */
583 GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor;
584
585 /**
568 * Function to pretty-print addresses. NOTE: this function is not 586 * Function to pretty-print addresses. NOTE: this function is not
569 * yet used by transport-service, but will be used in the future 587 * yet used by transport-service, but will be used in the future
570 * once the transport-API has been completed. 588 * once the transport-API has been completed.
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index eb3ad1d07..c4d4677b1 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -55,15 +55,6 @@
55#define QUOTA_VIOLATION_DROP_THRESHOLD 10 55#define QUOTA_VIOLATION_DROP_THRESHOLD 10
56 56
57/** 57/**
58 * How often do we send KEEPALIVE messages to each of our neighbours and measure
59 * the latency with this neighbour?
60 * (idle timeout is 5 minutes or 300 seconds, so with 100s interval we
61 * send 3 keepalives in each interval, so 3 messages would need to be
62 * lost in a row for a disconnect).
63 */
64#define KEEPALIVE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
65
66/**
67 * How long are we willing to wait for a response from ATS before timing out? 58 * How long are we willing to wait for a response from ATS before timing out?
68 */ 59 */
69#define ATS_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 5000) 60#define ATS_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 5000)
@@ -963,18 +954,24 @@ free_neighbour (struct NeighbourMapEntry *n,
963 * @param msgbuf_size number of bytes in @a msgbuf buffer 954 * @param msgbuf_size number of bytes in @a msgbuf buffer
964 * @param priority transmission priority 955 * @param priority transmission priority
965 * @param timeout transmission timeout 956 * @param timeout transmission timeout
957 * @param use_keepalive_timeout #GNUNET_YES to use plugin-specific keep-alive
958 * timeout (@a timeout is ignored in that case), #GNUNET_NO otherwise
966 * @param cont continuation to call when finished (can be NULL) 959 * @param cont continuation to call when finished (can be NULL)
967 * @param cont_cls closure for @a cont 960 * @param cont_cls closure for @a cont
961 * @return timeout (copy of @a timeout or a calculated one if
962 * @a use_keepalive_timeout is #GNUNET_YES.
968 */ 963 */
969static void 964static struct GNUNET_TIME_Relative
970send_with_session (struct NeighbourMapEntry *n, 965send_with_session (struct NeighbourMapEntry *n,
971 const char *msgbuf, size_t msgbuf_size, 966 const char *msgbuf, size_t msgbuf_size,
972 uint32_t priority, 967 uint32_t priority,
973 struct GNUNET_TIME_Relative timeout, 968 struct GNUNET_TIME_Relative timeout,
969 unsigned int use_keepalive_timeout,
974 GNUNET_TRANSPORT_TransmitContinuation cont, 970 GNUNET_TRANSPORT_TransmitContinuation cont,
975 void *cont_cls) 971 void *cont_cls)
976{ 972{
977 struct GNUNET_TRANSPORT_PluginFunctions *papi; 973 struct GNUNET_TRANSPORT_PluginFunctions *papi;
974 struct GNUNET_TIME_Relative result = GNUNET_TIME_UNIT_FOREVER_REL;
978 975
979 GNUNET_assert (n->primary_address.session != NULL); 976 GNUNET_assert (n->primary_address.session != NULL);
980 if ( ((NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name)) || 977 if ( ((NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name)) ||
@@ -982,13 +979,16 @@ send_with_session (struct NeighbourMapEntry *n,
982 n->primary_address.session, 979 n->primary_address.session,
983 msgbuf, msgbuf_size, 980 msgbuf, msgbuf_size,
984 priority, 981 priority,
985 timeout, 982 (result = (GNUNET_NO == use_keepalive_timeout) ? timeout :
983 GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
984 papi->query_keepalive_factor (papi->cls))),
986 cont, cont_cls)))) && 985 cont, cont_cls)))) &&
987 (NULL != cont)) 986 (NULL != cont))
988 cont (cont_cls, &n->id, GNUNET_SYSERR, msgbuf_size, 0); 987 cont (cont_cls, &n->id, GNUNET_SYSERR, msgbuf_size, 0);
989 GST_neighbours_notify_data_sent (&n->id, 988 GST_neighbours_notify_data_sent (&n->id,
990 n->primary_address.address, n->primary_address.session, msgbuf_size); 989 n->primary_address.address, n->primary_address.session, msgbuf_size);
991 GNUNET_break (NULL != papi); 990 GNUNET_break (NULL != papi);
991 return result;
992} 992}
993 993
994 994
@@ -1063,10 +1063,10 @@ send_disconnect (struct NeighbourMapEntry *n)
1063 &disconnect_msg.purpose, 1063 &disconnect_msg.purpose,
1064 &disconnect_msg.signature)); 1064 &disconnect_msg.signature));
1065 1065
1066 send_with_session (n, 1066 (void) send_with_session (n,
1067 (const char *) &disconnect_msg, sizeof (disconnect_msg), 1067 (const char *) &disconnect_msg, sizeof (disconnect_msg),
1068 UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, 1068 UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
1069 &send_disconnect_cont, NULL); 1069 GNUNET_NO, &send_disconnect_cont, NULL);
1070 GNUNET_STATISTICS_update (GST_stats, 1070 GNUNET_STATISTICS_update (GST_stats,
1071 gettext_noop 1071 gettext_noop
1072 ("# DISCONNECT messages sent"), 1, 1072 ("# DISCONNECT messages sent"), 1,
@@ -1278,10 +1278,10 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1278 return; /* no more messages */ 1278 return; /* no more messages */
1279 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); 1279 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
1280 n->is_active = mq; 1280 n->is_active = mq;
1281 send_with_session (n, 1281 (void) send_with_session (n,
1282 mq->message_buf, mq->message_buf_size, 1282 mq->message_buf, mq->message_buf_size,
1283 0 /* priority */, timeout, 1283 0 /* priority */, timeout, GNUNET_NO,
1284 &transmit_send_continuation, mq); 1284 &transmit_send_continuation, mq);
1285} 1285}
1286 1286
1287 1287
@@ -1297,6 +1297,7 @@ static void
1297send_keepalive (struct NeighbourMapEntry *n) 1297send_keepalive (struct NeighbourMapEntry *n)
1298{ 1298{
1299 struct GNUNET_MessageHeader m; 1299 struct GNUNET_MessageHeader m;
1300 struct GNUNET_TIME_Relative timeout;
1300 1301
1301 GNUNET_assert ((S_CONNECTED == n->state) || 1302 GNUNET_assert ((S_CONNECTED == n->state) ||
1302 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || 1303 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) ||
@@ -1305,16 +1306,16 @@ send_keepalive (struct NeighbourMapEntry *n)
1305 return; /* no keepalive needed at this time */ 1306 return; /* no keepalive needed at this time */
1306 m.size = htons (sizeof (struct GNUNET_MessageHeader)); 1307 m.size = htons (sizeof (struct GNUNET_MessageHeader));
1307 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); 1308 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
1308 send_with_session (n, 1309 timeout = send_with_session (n,
1309 (const void *) &m, sizeof (m), 1310 (const void *) &m, sizeof (m),
1310 UINT32_MAX /* priority */, 1311 UINT32_MAX /* priority */,
1311 KEEPALIVE_FREQUENCY, 1312 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES,
1312 NULL, NULL); 1313 NULL, NULL);
1313 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1, 1314 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1,
1314 GNUNET_NO); 1315 GNUNET_NO);
1315 n->expect_latency_response = GNUNET_YES; 1316 n->expect_latency_response = GNUNET_YES;
1316 n->last_keep_alive_time = GNUNET_TIME_absolute_get (); 1317 n->last_keep_alive_time = GNUNET_TIME_absolute_get ();
1317 n->keep_alive_time = GNUNET_TIME_relative_to_absolute (KEEPALIVE_FREQUENCY); 1318 n->keep_alive_time = GNUNET_TIME_relative_to_absolute (timeout);
1318} 1319}
1319 1320
1320 1321
@@ -1349,11 +1350,11 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour)
1349 /* send reply to allow neighbour to measure latency */ 1350 /* send reply to allow neighbour to measure latency */
1350 m.size = htons (sizeof (struct GNUNET_MessageHeader)); 1351 m.size = htons (sizeof (struct GNUNET_MessageHeader));
1351 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE); 1352 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
1352 send_with_session(n, 1353 (void) send_with_session(n,
1353 (const void *) &m, sizeof (m), 1354 (const void *) &m, sizeof (m),
1354 UINT32_MAX /* priority */, 1355 UINT32_MAX /* priority */,
1355 KEEPALIVE_FREQUENCY, 1356 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES,
1356 NULL, NULL); 1357 NULL, NULL);
1357} 1358}
1358 1359
1359 1360
@@ -2769,7 +2770,7 @@ send_session_ack_message (struct NeighbourMapEntry *n)
2769 msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK); 2770 msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK);
2770 (void) send_with_session(n, 2771 (void) send_with_session(n,
2771 (const char *) &msg, sizeof (struct GNUNET_MessageHeader), 2772 (const char *) &msg, sizeof (struct GNUNET_MessageHeader),
2772 UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, 2773 UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO,
2773 NULL, NULL); 2774 NULL, NULL);
2774} 2775}
2775 2776
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c
index 87130feec..7fbdbcfa9 100644
--- a/src/transport/plugin_transport_bluetooth.c
+++ b/src/transport/plugin_transport_bluetooth.c
@@ -1120,6 +1120,21 @@ bluetooth_plugin_disconnect_session (void *cls,
1120 1120
1121 1121
1122/** 1122/**
1123 * Function that is called to get the keepalive factor.
1124 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
1125 * calculate the interval between keepalive packets.
1126 *
1127 * @param cls closure with the `struct Plugin`
1128 * @return keepalive factor
1129 */
1130static unsigned int
1131bluetooth_query_keepalive_factor (void *cls)
1132{
1133 return 3;
1134}
1135
1136
1137/**
1123 * Function that can be used by the transport service to transmit 1138 * Function that can be used by the transport service to transmit
1124 * a message using the plugin. Note that in the case of a 1139 * a message using the plugin. Note that in the case of a
1125 * peer disconnecting, the continuation MUST be called 1140 * peer disconnecting, the continuation MUST be called
@@ -1912,6 +1927,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1912 api->get_session = &bluetooth_plugin_get_session; 1927 api->get_session = &bluetooth_plugin_get_session;
1913 api->disconnect_peer = &bluetooth_plugin_disconnect_peer; 1928 api->disconnect_peer = &bluetooth_plugin_disconnect_peer;
1914 api->disconnect_session = &bluetooth_plugin_disconnect_session; 1929 api->disconnect_session = &bluetooth_plugin_disconnect_session;
1930 api->query_keepalive_factor = &bluetooth_query_keepalive_factor;
1915 api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer; 1931 api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer;
1916 api->check_address = &bluetooth_plugin_address_suggested; 1932 api->check_address = &bluetooth_plugin_address_suggested;
1917 api->address_to_string = &bluetooth_plugin_address_to_string;; 1933 api->address_to_string = &bluetooth_plugin_address_to_string;;
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 78f973574..b2bb5d513 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -700,6 +700,21 @@ http_client_session_disconnect (void *cls,
700 700
701 701
702/** 702/**
703 * Function that is called to get the keepalive factor.
704 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
705 * calculate the interval between keepalive packets.
706 *
707 * @param cls closure with the `struct Plugin`
708 * @return keepalive factor
709 */
710static unsigned int
711http_client_query_keepalive_factor (void *cls)
712{
713 return 3;
714}
715
716
717/**
703 * Function that can be used to force the plugin to disconnect 718 * Function that can be used to force the plugin to disconnect
704 * from the given peer and cancel all previous transmissions 719 * from the given peer and cancel all previous transmissions
705 * (and their continuationc). 720 * (and their continuationc).
@@ -1773,6 +1788,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
1773 api->cls = plugin; 1788 api->cls = plugin;
1774 api->send = &http_client_plugin_send; 1789 api->send = &http_client_plugin_send;
1775 api->disconnect_session = &http_client_session_disconnect; 1790 api->disconnect_session = &http_client_session_disconnect;
1791 api->query_keepalive_factor = &http_client_query_keepalive_factor;
1776 api->disconnect_peer = &http_client_peer_disconnect; 1792 api->disconnect_peer = &http_client_peer_disconnect;
1777 api->check_address = &http_client_plugin_address_suggested; 1793 api->check_address = &http_client_plugin_address_suggested;
1778 api->get_session = &http_client_plugin_get_session; 1794 api->get_session = &http_client_plugin_get_session;
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index ca6c0febc..19fd632b8 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -887,6 +887,21 @@ http_server_plugin_disconnect_session (void *cls,
887 887
888 888
889/** 889/**
890 * Function that is called to get the keepalive factor.
891 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
892 * calculate the interval between keepalive packets.
893 *
894 * @param cls closure with the `struct Plugin`
895 * @return keepalive factor
896 */
897static unsigned int
898http_server_query_keepalive_factor (void *cls)
899{
900 return 3;
901}
902
903
904/**
890 * Tell MHD that the connection should timeout after @a to seconds. 905 * Tell MHD that the connection should timeout after @a to seconds.
891 * 906 *
892 * @param plugin our plugin 907 * @param plugin our plugin
@@ -3098,6 +3113,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3098 api->send = &http_server_plugin_send; 3113 api->send = &http_server_plugin_send;
3099 api->disconnect_peer = &http_server_plugin_disconnect_peer; 3114 api->disconnect_peer = &http_server_plugin_disconnect_peer;
3100 api->disconnect_session = &http_server_plugin_disconnect_session; 3115 api->disconnect_session = &http_server_plugin_disconnect_session;
3116 api->query_keepalive_factor = &http_server_query_keepalive_factor;
3101 api->check_address = &http_server_plugin_address_suggested; 3117 api->check_address = &http_server_plugin_address_suggested;
3102 api->get_session = &http_server_plugin_get_session; 3118 api->get_session = &http_server_plugin_get_session;
3103 3119
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index e22e01cee..992729911 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -865,6 +865,21 @@ tcp_disconnect_session (void *cls,
865 865
866 866
867/** 867/**
868 * Function that is called to get the keepalive factor.
869 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
870 * calculate the interval between keepalive packets.
871 *
872 * @param cls closure with the `struct Plugin`
873 * @return keepalive factor
874 */
875static unsigned int
876tcp_query_keepalive_factor (void *cls)
877{
878 return 3;
879}
880
881
882/**
868 * Session was idle, so disconnect it 883 * Session was idle, so disconnect it
869 * 884 *
870 * @param cls the `struct Session` of the idle session 885 * @param cls the `struct Session` of the idle session
@@ -2665,6 +2680,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2665 api->get_session = &tcp_plugin_get_session; 2680 api->get_session = &tcp_plugin_get_session;
2666 2681
2667 api->disconnect_session = &tcp_disconnect_session; 2682 api->disconnect_session = &tcp_disconnect_session;
2683 api->query_keepalive_factor = &tcp_query_keepalive_factor;
2668 api->disconnect_peer = &tcp_plugin_disconnect; 2684 api->disconnect_peer = &tcp_plugin_disconnect;
2669 api->address_pretty_printer = &tcp_plugin_address_pretty_printer; 2685 api->address_pretty_printer = &tcp_plugin_address_pretty_printer;
2670 api->check_address = &tcp_plugin_check_address; 2686 api->check_address = &tcp_plugin_check_address;
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index feb0802d9..abcae5111 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -224,6 +224,21 @@ template_plugin_disconnect_session (void *cls,
224 224
225 225
226/** 226/**
227 * Function that is called to get the keepalive factor.
228 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
229 * calculate the interval between keepalive packets.
230 *
231 * @param cls closure with the `struct Plugin`
232 * @return keepalive factor
233 */
234static unsigned int
235template_plugin_query_keepalive_factor (void *cls)
236{
237 return 3;
238}
239
240
241/**
227 * Function obtain the network type for a session 242 * Function obtain the network type for a session
228 * 243 *
229 * @param cls closure ('struct Plugin*') 244 * @param cls closure ('struct Plugin*')
@@ -393,6 +408,7 @@ libgnunet_plugin_transport_template_init (void *cls)
393 api->send = &template_plugin_send; 408 api->send = &template_plugin_send;
394 api->disconnect_peer = &template_plugin_disconnect_peer; 409 api->disconnect_peer = &template_plugin_disconnect_peer;
395 api->disconnect_session = &template_plugin_disconnect_session; 410 api->disconnect_session = &template_plugin_disconnect_session;
411 api->query_keepalive_factor = &template_plugin_query_keepalive_factor;
396 api->address_pretty_printer = &template_plugin_address_pretty_printer; 412 api->address_pretty_printer = &template_plugin_address_pretty_printer;
397 api->check_address = &template_plugin_address_suggested; 413 api->check_address = &template_plugin_address_suggested;
398 api->address_to_string = &template_plugin_address_to_string; 414 api->address_to_string = &template_plugin_address_to_string;
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 904473ace..fb08e4349 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1314,6 +1314,21 @@ udp_disconnect_session (void *cls,
1314 1314
1315 1315
1316/** 1316/**
1317 * Function that is called to get the keepalive factor.
1318 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
1319 * calculate the interval between keepalive packets.
1320 *
1321 * @param cls closure with the `struct Plugin`
1322 * @return keepalive factor
1323 */
1324static unsigned int
1325udp_query_keepalive_factor (void *cls)
1326{
1327 return 15;
1328}
1329
1330
1331/**
1317 * Destroy a session, plugin is being unloaded. 1332 * Destroy a session, plugin is being unloaded.
1318 * 1333 *
1319 * @param cls the `struct Plugin` 1334 * @param cls the `struct Plugin`
@@ -3169,6 +3184,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
3169 api->cls = p; 3184 api->cls = p;
3170 api->send = NULL; 3185 api->send = NULL;
3171 api->disconnect_session = &udp_disconnect_session; 3186 api->disconnect_session = &udp_disconnect_session;
3187 api->query_keepalive_factor = &udp_query_keepalive_factor;
3172 api->disconnect_peer = &udp_disconnect; 3188 api->disconnect_peer = &udp_disconnect;
3173 api->address_pretty_printer = &udp_plugin_address_pretty_printer; 3189 api->address_pretty_printer = &udp_plugin_address_pretty_printer;
3174 api->address_to_string = &udp_address_to_string; 3190 api->address_to_string = &udp_address_to_string;
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 3d6ac4d23..906cf9997 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -600,6 +600,21 @@ unix_session_disconnect (void *cls,
600 600
601 601
602/** 602/**
603 * Function that is called to get the keepalive factor.
604 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
605 * calculate the interval between keepalive packets.
606 *
607 * @param cls closure with the `struct Plugin`
608 * @return keepalive factor
609 */
610static unsigned int
611unix_query_keepalive_factor (void *cls)
612{
613 return 3;
614}
615
616
617/**
603 * Actually send out the message, assume we've got the address and 618 * Actually send out the message, assume we've got the address and
604 * send_handle squared away! 619 * send_handle squared away!
605 * 620 *
@@ -1614,6 +1629,7 @@ libgnunet_plugin_transport_unix_init (void *cls)
1614 api->send = &unix_plugin_send; 1629 api->send = &unix_plugin_send;
1615 api->disconnect_peer = &unix_peer_disconnect; 1630 api->disconnect_peer = &unix_peer_disconnect;
1616 api->disconnect_session = &unix_session_disconnect; 1631 api->disconnect_session = &unix_session_disconnect;
1632 api->query_keepalive_factor = &unix_query_keepalive_factor;
1617 api->address_pretty_printer = &unix_plugin_address_pretty_printer; 1633 api->address_pretty_printer = &unix_plugin_address_pretty_printer;
1618 api->address_to_string = &unix_address_to_string; 1634 api->address_to_string = &unix_address_to_string;
1619 api->check_address = &unix_check_address; 1635 api->check_address = &unix_check_address;
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 3e1a6396c..916998dcc 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -696,6 +696,21 @@ wlan_plugin_disconnect_session (void *cls,
696 696
697 697
698/** 698/**
699 * Function that is called to get the keepalive factor.
700 * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
701 * calculate the interval between keepalive packets.
702 *
703 * @param cls closure with the `struct Plugin`
704 * @return keepalive factor
705 */
706static unsigned int
707wlan_plugin_query_keepalive_factor (void *cls)
708{
709 return 3;
710}
711
712
713/**
699 * A session is timing out. Clean up. 714 * A session is timing out. Clean up.
700 * 715 *
701 * @param cls pointer to the Session 716 * @param cls pointer to the Session
@@ -1968,6 +1983,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1968 api->get_session = &wlan_plugin_get_session; 1983 api->get_session = &wlan_plugin_get_session;
1969 api->disconnect_peer = &wlan_plugin_disconnect_peer; 1984 api->disconnect_peer = &wlan_plugin_disconnect_peer;
1970 api->disconnect_session = &wlan_plugin_disconnect_session; 1985 api->disconnect_session = &wlan_plugin_disconnect_session;
1986 api->query_keepalive_factor = &wlan_plugin_query_keepalive_factor;
1971 api->address_pretty_printer = &wlan_plugin_address_pretty_printer; 1987 api->address_pretty_printer = &wlan_plugin_address_pretty_printer;
1972 api->check_address = &wlan_plugin_address_suggested; 1988 api->check_address = &wlan_plugin_address_suggested;
1973 api->address_to_string = &wlan_plugin_address_to_string; 1989 api->address_to_string = &wlan_plugin_address_to_string;