aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-23 11:40:41 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-23 11:40:41 +0000
commit8e7b3d117600e84a4625149204e8d6e1d6472946 (patch)
treeb97456aaf1a69256d395d78e9a81694ed726a7d6 /src/transport/plugin_transport_tcp.c
parent7fea1d9e013cc441d72b155b3b06348b1d689261 (diff)
downloadgnunet-8e7b3d117600e84a4625149204e8d6e1d6472946.tar.gz
gnunet-8e7b3d117600e84a4625149204e8d6e1d6472946.zip
adding missing monitoring callbacks for TCP
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c213
1 files changed, 143 insertions, 70 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index f3791c138..01c3a0b1a 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -820,10 +820,10 @@ tcp_disconnect_session (void *cls,
820 struct Plugin *plugin = cls; 820 struct Plugin *plugin = cls;
821 struct PendingMessage *pm; 821 struct PendingMessage *pm;
822 822
823 LOG(GNUNET_ERROR_TYPE_DEBUG, 823 LOG (GNUNET_ERROR_TYPE_DEBUG,
824 "Disconnecting session of peer `%s' address `%s'\n", 824 "Disconnecting session of peer `%s' address `%s'\n",
825 GNUNET_i2s (&session->target), 825 GNUNET_i2s (&session->target),
826 tcp_address_to_string (NULL, 826 tcp_address_to_string (NULL,
827 session->address->address, 827 session->address->address,
828 session->address->address_length)); 828 session->address->address_length));
829 829
@@ -834,9 +834,10 @@ tcp_disconnect_session (void *cls,
834 session->timeout = GNUNET_TIME_UNIT_ZERO_ABS; 834 session->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
835 } 835 }
836 836
837 if (GNUNET_YES 837 if (GNUNET_YES ==
838 == GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap, 838 GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap,
839 &session->target, session)) 839 &session->target,
840 session))
840 { 841 {
841 GNUNET_STATISTICS_update (session->plugin->env->stats, 842 GNUNET_STATISTICS_update (session->plugin->env->stats,
842 gettext_noop ("# TCP sessions active"), -1, GNUNET_NO); 843 gettext_noop ("# TCP sessions active"), -1, GNUNET_NO);
@@ -859,9 +860,12 @@ tcp_disconnect_session (void *cls,
859 session->transmit_handle = NULL; 860 session->transmit_handle = NULL;
860 } 861 }
861 plugin->env->unregister_quota_notification (plugin->env->cls, 862 plugin->env->unregister_quota_notification (plugin->env->cls,
862 &session->target, PLUGIN_NAME, session); 863 &session->target,
864 PLUGIN_NAME,
865 session);
863 session->plugin->env->session_end (session->plugin->env->cls, 866 session->plugin->env->session_end (session->plugin->env->cls,
864 session->address, session); 867 session->address,
868 session);
865 869
866 if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout) 870 if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout)
867 { 871 {
@@ -898,6 +902,12 @@ tcp_disconnect_session (void *cls,
898 0); 902 0);
899 GNUNET_free (pm); 903 GNUNET_free (pm);
900 } 904 }
905 GNUNET_assert (0 == session->msgs_in_queue);
906 GNUNET_assert (0 == session->bytes_in_queue);
907 notify_session_monitor (session->plugin,
908 session,
909 GNUNET_TRANSPORT_SS_UP);
910
901 if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK ) 911 if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK )
902 { 912 {
903 GNUNET_SCHEDULER_cancel (session->receive_delay_task); 913 GNUNET_SCHEDULER_cancel (session->receive_delay_task);
@@ -1008,9 +1018,9 @@ create_session (struct Plugin *plugin,
1008 else 1018 else
1009 GNUNET_assert(NULL == client); 1019 GNUNET_assert(NULL == client);
1010 1020
1011 LOG(GNUNET_ERROR_TYPE_DEBUG, 1021 LOG (GNUNET_ERROR_TYPE_DEBUG,
1012 "Creating new session for peer `%4s'\n", 1022 "Creating new session for peer `%4s'\n",
1013 GNUNET_i2s (&address->peer)); 1023 GNUNET_i2s (&address->peer));
1014 session = GNUNET_new (struct Session); 1024 session = GNUNET_new (struct Session);
1015 session->last_activity = GNUNET_TIME_absolute_get (); 1025 session->last_activity = GNUNET_TIME_absolute_get ();
1016 session->plugin = plugin; 1026 session->plugin = plugin;
@@ -1037,17 +1047,30 @@ create_session (struct Plugin *plugin,
1037 pm); 1047 pm);
1038 session->msgs_in_queue++; 1048 session->msgs_in_queue++;
1039 session->bytes_in_queue += pm->message_size; 1049 session->bytes_in_queue += pm->message_size;
1050 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
1051 session->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1052 &session_timeout,
1053 session);
1040 if (GNUNET_YES != is_nat) 1054 if (GNUNET_YES != is_nat)
1041 { 1055 {
1042 GNUNET_STATISTICS_update (plugin->env->stats, 1056 GNUNET_STATISTICS_update (plugin->env->stats,
1043 gettext_noop ("# TCP sessions active"), 1, GNUNET_NO); 1057 gettext_noop ("# TCP sessions active"),
1058 1,
1059 GNUNET_NO);
1060 notify_session_monitor (session->plugin,
1061 session,
1062 GNUNET_TRANSPORT_SS_UP);
1063 }
1064 else
1065 {
1066 notify_session_monitor (session->plugin,
1067 session,
1068 GNUNET_TRANSPORT_SS_HANDSHAKE);
1044 } 1069 }
1045 plugin->env->register_quota_notification (plugin->env->cls, 1070 plugin->env->register_quota_notification (plugin->env->cls,
1046 &address->peer, PLUGIN_NAME, session); 1071 &address->peer,
1047 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1072 PLUGIN_NAME,
1048 session->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 1073 session);
1049 &session_timeout,
1050 session);
1051 return session; 1074 return session;
1052} 1075}
1053 1076
@@ -1130,13 +1153,19 @@ do_transmit (void *cls, size_t size, void *buf)
1130 &pid, 1153 &pid,
1131 GNUNET_SYSERR, 1154 GNUNET_SYSERR,
1132 pos->message_size, 0); 1155 pos->message_size, 0);
1133 GNUNET_free(pos); 1156 GNUNET_free (pos);
1134 } 1157 }
1135 GNUNET_STATISTICS_update (plugin->env->stats, 1158 GNUNET_STATISTICS_update (plugin->env->stats,
1136 gettext_noop ("# bytes currently in TCP buffers"), -(int64_t) ret, 1159 gettext_noop ("# bytes currently in TCP buffers"), -(int64_t) ret,
1137 GNUNET_NO); 1160 GNUNET_NO);
1138 GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop 1161 GNUNET_STATISTICS_update (plugin->env->stats,
1139 ("# bytes discarded by TCP (timeout)"), ret, GNUNET_NO); 1162 gettext_noop ("# bytes discarded by TCP (timeout)"),
1163 ret,
1164 GNUNET_NO);
1165 if (0 < ret)
1166 notify_session_monitor (session->plugin,
1167 session,
1168 GNUNET_TRANSPORT_SS_UP);
1140 return 0; 1169 return 0;
1141 } 1170 }
1142 /* copy all pending messages that would fit */ 1171 /* copy all pending messages that would fit */
@@ -1167,6 +1196,9 @@ do_transmit (void *cls, size_t size, void *buf)
1167 size -= pos->message_size; 1196 size -= pos->message_size;
1168 GNUNET_CONTAINER_DLL_insert_tail (hd, tl, pos); 1197 GNUNET_CONTAINER_DLL_insert_tail (hd, tl, pos);
1169 } 1198 }
1199 notify_session_monitor (session->plugin,
1200 session,
1201 GNUNET_TRANSPORT_SS_UP);
1170 /* schedule 'continuation' before callbacks so that callbacks that 1202 /* schedule 'continuation' before callbacks so that callbacks that
1171 * cancel everything don't cause us to use a session that no longer 1203 * cancel everything don't cause us to use a session that no longer
1172 * exists... */ 1204 * exists... */
@@ -1260,6 +1292,7 @@ session_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
1260 return GNUNET_YES; 1292 return GNUNET_YES;
1261} 1293}
1262 1294
1295
1263/** 1296/**
1264 * Check that the given session is known to the plugin and 1297 * Check that the given session is known to the plugin and
1265 * is in one of our maps. 1298 * is in one of our maps.
@@ -1320,9 +1353,14 @@ find_session (struct Plugin *plugin, struct Session *session)
1320 * and does NOT mean that the message was not transmitted (DV) 1353 * and does NOT mean that the message was not transmitted (DV)
1321 */ 1354 */
1322static ssize_t 1355static ssize_t
1323tcp_plugin_send (void *cls, struct Session *session, const char *msgbuf, 1356tcp_plugin_send (void *cls,
1324 size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Relative to, 1357 struct Session *session,
1325 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 1358 const char *msgbuf,
1359 size_t msgbuf_size,
1360 unsigned int priority,
1361 struct GNUNET_TIME_Relative to,
1362 GNUNET_TRANSPORT_TransmitContinuation cont,
1363 void *cont_cls)
1326{ 1364{
1327 struct Plugin * plugin = cls; 1365 struct Plugin * plugin = cls;
1328 struct PendingMessage *pm; 1366 struct PendingMessage *pm;
@@ -1364,34 +1402,41 @@ tcp_plugin_send (void *cls, struct Session *session, const char *msgbuf,
1364 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, 1402 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
1365 session->pending_messages_tail, 1403 session->pending_messages_tail,
1366 pm); 1404 pm);
1405 notify_session_monitor (session->plugin,
1406 session,
1407 GNUNET_TRANSPORT_SS_UP);
1367 session->msgs_in_queue++; 1408 session->msgs_in_queue++;
1368 session->bytes_in_queue += pm->message_size; 1409 session->bytes_in_queue += pm->message_size;
1369 process_pending_messages (session); 1410 process_pending_messages (session);
1370 return msgbuf_size; 1411 return msgbuf_size;
1371 } 1412 }
1372 else if (GNUNET_YES 1413 else if (GNUNET_YES ==
1373 == GNUNET_CONTAINER_multipeermap_contains_value (plugin->nat_wait_conns, 1414 GNUNET_CONTAINER_multipeermap_contains_value (plugin->nat_wait_conns,
1374 &session->target, session)) 1415 &session->target,
1416 session))
1375 { 1417 {
1376 LOG(GNUNET_ERROR_TYPE_DEBUG, 1418 LOG (GNUNET_ERROR_TYPE_DEBUG,
1377 "This NAT WAIT session for peer `%s' is not yet ready!\n", 1419 "This NAT WAIT session for peer `%s' is not yet ready!\n",
1378 GNUNET_i2s (&session->target)); 1420 GNUNET_i2s (&session->target));
1379 GNUNET_STATISTICS_update (plugin->env->stats, 1421 GNUNET_STATISTICS_update (plugin->env->stats,
1380 gettext_noop ("# bytes currently in TCP buffers"), msgbuf_size, 1422 gettext_noop ("# bytes currently in TCP buffers"), msgbuf_size,
1381 GNUNET_NO); 1423 GNUNET_NO);
1382
1383 /* append pm to pending_messages list */ 1424 /* append pm to pending_messages list */
1384 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, 1425 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
1385 session->pending_messages_tail, 1426 session->pending_messages_tail,
1386 pm); 1427 pm);
1387 session->msgs_in_queue++; 1428 session->msgs_in_queue++;
1388 session->bytes_in_queue += pm->message_size; 1429 session->bytes_in_queue += pm->message_size;
1430 notify_session_monitor (session->plugin,
1431 session,
1432 GNUNET_TRANSPORT_SS_HANDSHAKE);
1389 return msgbuf_size; 1433 return msgbuf_size;
1390 } 1434 }
1391 else 1435 else
1392 { 1436 {
1393 LOG(GNUNET_ERROR_TYPE_ERROR, 1437 LOG(GNUNET_ERROR_TYPE_ERROR,
1394 "Invalid session %p\n", session); 1438 "Invalid session %p\n",
1439 session);
1395 if (NULL != cont) 1440 if (NULL != cont)
1396 cont (cont_cls, 1441 cont (cont_cls,
1397 &session->target, 1442 &session->target,
@@ -1445,6 +1490,7 @@ session_lookup_it (void *cls,
1445 return GNUNET_NO; 1490 return GNUNET_NO;
1446} 1491}
1447 1492
1493
1448/** 1494/**
1449 * Task cleaning up a NAT connection attempt after timeout 1495 * Task cleaning up a NAT connection attempt after timeout
1450 * 1496 *
@@ -1452,7 +1498,8 @@ session_lookup_it (void *cls,
1452 * @param tc scheduler context (unused) 1498 * @param tc scheduler context (unused)
1453 */ 1499 */
1454static void 1500static void
1455nat_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1501nat_connect_timeout (void *cls,
1502 const struct GNUNET_SCHEDULER_TaskContext *tc)
1456{ 1503{
1457 struct Session *session = cls; 1504 struct Session *session = cls;
1458 1505
@@ -1464,9 +1511,11 @@ nat_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1464 tcp_disconnect_session (session->plugin, session); 1511 tcp_disconnect_session (session->plugin, session);
1465} 1512}
1466 1513
1514
1467static void 1515static void
1468tcp_plugin_update_session_timeout (void *cls, 1516tcp_plugin_update_session_timeout (void *cls,
1469 const struct GNUNET_PeerIdentity *peer, struct Session *session) 1517 const struct GNUNET_PeerIdentity *peer,
1518 struct Session *session)
1470{ 1519{
1471 struct Plugin *plugin = cls; 1520 struct Plugin *plugin = cls;
1472 1521
@@ -1493,10 +1542,12 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1493 GNUNET_SERVER_receive_done (session->client, GNUNET_OK); 1542 GNUNET_SERVER_receive_done (session->client, GNUNET_OK);
1494} 1543}
1495 1544
1496static void tcp_plugin_update_inbound_delay (void *cls, 1545
1497 const struct GNUNET_PeerIdentity *peer, 1546static void
1498 struct Session *session, 1547tcp_plugin_update_inbound_delay (void *cls,
1499 struct GNUNET_TIME_Relative delay) 1548 const struct GNUNET_PeerIdentity *peer,
1549 struct Session *session,
1550 struct GNUNET_TIME_Relative delay)
1500{ 1551{
1501 if (GNUNET_SCHEDULER_NO_TASK == session->receive_delay_task) 1552 if (GNUNET_SCHEDULER_NO_TASK == session->receive_delay_task)
1502 return; 1553 return;
@@ -1520,7 +1571,8 @@ static void tcp_plugin_update_inbound_delay (void *cls,
1520 * @return the session if the address is valid, NULL otherwise 1571 * @return the session if the address is valid, NULL otherwise
1521 */ 1572 */
1522static struct Session * 1573static struct Session *
1523tcp_plugin_get_session (void *cls, const struct GNUNET_HELLO_Address *address) 1574tcp_plugin_get_session (void *cls,
1575 const struct GNUNET_HELLO_Address *address)
1524{ 1576{
1525 struct Plugin *plugin = cls; 1577 struct Plugin *plugin = cls;
1526 struct Session *session = NULL; 1578 struct Session *session = NULL;
@@ -1709,9 +1761,11 @@ tcp_plugin_get_session (void *cls, const struct GNUNET_HELLO_Address *address)
1709 return session; 1761 return session;
1710} 1762}
1711 1763
1764
1712static int 1765static int
1713session_disconnect_it (void *cls, const struct GNUNET_PeerIdentity *key, 1766session_disconnect_it (void *cls,
1714 void *value) 1767 const struct GNUNET_PeerIdentity *key,
1768 void *value)
1715{ 1769{
1716 struct Plugin *plugin = cls; 1770 struct Plugin *plugin = cls;
1717 struct Session *session = value; 1771 struct Session *session = value;
@@ -1722,6 +1776,7 @@ session_disconnect_it (void *cls, const struct GNUNET_PeerIdentity *key,
1722 return GNUNET_YES; 1776 return GNUNET_YES;
1723} 1777}
1724 1778
1779
1725/** 1780/**
1726 * Function that can be called to force a disconnect from the 1781 * Function that can be called to force a disconnect from the
1727 * specified neighbour. This should also cancel all previously 1782 * specified neighbour. This should also cancel all previously
@@ -1739,19 +1794,25 @@ session_disconnect_it (void *cls, const struct GNUNET_PeerIdentity *key,
1739 * to be cancelled 1794 * to be cancelled
1740 */ 1795 */
1741static void 1796static void
1742tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) 1797tcp_plugin_disconnect (void *cls,
1798 const struct GNUNET_PeerIdentity *target)
1743{ 1799{
1744 struct Plugin *plugin = cls; 1800 struct Plugin *plugin = cls;
1745 1801
1746 LOG(GNUNET_ERROR_TYPE_DEBUG, 1802 LOG(GNUNET_ERROR_TYPE_DEBUG,
1747 "Disconnecting peer `%4s'\n", 1803 "Disconnecting peer `%4s'\n",
1748 GNUNET_i2s (target)); 1804 GNUNET_i2s (target));
1749 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target, 1805 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap,
1750 &session_disconnect_it, plugin); 1806 target,
1751 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target, 1807 &session_disconnect_it,
1752 &session_disconnect_it, plugin); 1808 plugin);
1809 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns,
1810 target,
1811 &session_disconnect_it,
1812 plugin);
1753} 1813}
1754 1814
1815
1755/** 1816/**
1756 * Running pretty printers: head 1817 * Running pretty printers: head
1757 */ 1818 */
@@ -2052,8 +2113,9 @@ tcp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
2052 * @param message the actual message 2113 * @param message the actual message
2053 */ 2114 */
2054static void 2115static void
2055handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, 2116handle_tcp_nat_probe (void *cls,
2056 const struct GNUNET_MessageHeader *message) 2117 struct GNUNET_SERVER_Client *client,
2118 const struct GNUNET_MessageHeader *message)
2057{ 2119{
2058 struct Plugin *plugin = cls; 2120 struct Plugin *plugin = cls;
2059 struct Session *session; 2121 struct Session *session;
@@ -2170,8 +2232,9 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
2170 * @param message the actual message 2232 * @param message the actual message
2171 */ 2233 */
2172static void 2234static void
2173handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client, 2235handle_tcp_welcome (void *cls,
2174 const struct GNUNET_MessageHeader *message) 2236 struct GNUNET_SERVER_Client *client,
2237 const struct GNUNET_MessageHeader *message)
2175{ 2238{
2176 struct Plugin *plugin = cls; 2239 struct Plugin *plugin = cls;
2177 const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message; 2240 const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message;
@@ -2308,8 +2371,9 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client,
2308 * @param message the actual message 2371 * @param message the actual message
2309 */ 2372 */
2310static void 2373static void
2311handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, 2374handle_tcp_data (void *cls,
2312 const struct GNUNET_MessageHeader *message) 2375 struct GNUNET_SERVER_Client *client,
2376 const struct GNUNET_MessageHeader *message)
2313{ 2377{
2314 struct Plugin *plugin = cls; 2378 struct Plugin *plugin = cls;
2315 struct Session *session; 2379 struct Session *session;
@@ -2373,13 +2437,18 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2373 distance.value = htonl ((uint32_t) session->ats_address_network_type); 2437 distance.value = htonl ((uint32_t) session->ats_address_network_type);
2374 GNUNET_break(session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED); 2438 GNUNET_break(session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
2375 2439
2376 GNUNET_assert( 2440 GNUNET_assert(GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
2377 GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, 2441 &session->target,
2378 &session->target, session)); 2442 session));
2379 2443
2380 delay = plugin->env->receive (plugin->env->cls, session->address, session, message); 2444 delay = plugin->env->receive (plugin->env->cls,
2381 plugin->env->update_address_metrics (plugin->env->cls, session->address, 2445 session->address,
2382 session, &distance, 1); 2446 session,
2447 message);
2448 plugin->env->update_address_metrics (plugin->env->cls,
2449 session->address,
2450 session,
2451 &distance, 1);
2383 reschedule_session_timeout (session); 2452 reschedule_session_timeout (session);
2384 if (0 == delay.rel_value_us) 2453 if (0 == delay.rel_value_us)
2385 { 2454 {
@@ -2397,6 +2466,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2397 } 2466 }
2398} 2467}
2399 2468
2469
2400/** 2470/**
2401 * Functions with this signature are called whenever a peer 2471 * Functions with this signature are called whenever a peer
2402 * is disconnected on the network level. 2472 * is disconnected on the network level.
@@ -2415,11 +2485,11 @@ disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client)
2415 session = lookup_session_by_client (plugin, client); 2485 session = lookup_session_by_client (plugin, client);
2416 if (NULL == session) 2486 if (NULL == session)
2417 return; /* unknown, nothing to do */ 2487 return; /* unknown, nothing to do */
2418 LOG(GNUNET_ERROR_TYPE_DEBUG, 2488 LOG (GNUNET_ERROR_TYPE_DEBUG,
2419 "Destroying session of `%4s' with %s due to network-level disconnect.\n", 2489 "Destroying session of `%4s' with %s due to network-level disconnect.\n",
2420 GNUNET_i2s (&session->target), 2490 GNUNET_i2s (&session->target),
2421 tcp_address_to_string (session->plugin, session->address->address, 2491 tcp_address_to_string (session->plugin, session->address->address,
2422 session->address->address_length)); 2492 session->address->address_length));
2423 2493
2424 if (plugin->cur_connections == plugin->max_connections) 2494 if (plugin->cur_connections == plugin->max_connections)
2425 GNUNET_SERVER_resume (plugin->server); /* Resume server */ 2495 GNUNET_SERVER_resume (plugin->server); /* Resume server */
@@ -2430,10 +2500,13 @@ disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client)
2430 plugin->cur_connections--; 2500 plugin->cur_connections--;
2431 2501
2432 GNUNET_STATISTICS_update (session->plugin->env->stats, gettext_noop 2502 GNUNET_STATISTICS_update (session->plugin->env->stats, gettext_noop
2433 ("# network-level TCP disconnect events"), 1, GNUNET_NO); 2503 ("# network-level TCP disconnect events"),
2504 1,
2505 GNUNET_NO);
2434 tcp_disconnect_session (plugin, session); 2506 tcp_disconnect_session (plugin, session);
2435} 2507}
2436 2508
2509
2437/** 2510/**
2438 * We can now send a probe message, copy into buffer to really send. 2511 * We can now send a probe message, copy into buffer to really send.
2439 * 2512 *
@@ -2464,7 +2537,7 @@ notify_send_probe (void *cls,
2464 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); 2537 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message));
2465 memcpy (buf, &tcp_probe_ctx->message, sizeof(tcp_probe_ctx->message)); 2538 memcpy (buf, &tcp_probe_ctx->message, sizeof(tcp_probe_ctx->message));
2466 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, 2539 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server,
2467 tcp_probe_ctx->sock); 2540 tcp_probe_ctx->sock);
2468 ret = sizeof(tcp_probe_ctx->message); 2541 ret = sizeof(tcp_probe_ctx->message);
2469 GNUNET_free(tcp_probe_ctx); 2542 GNUNET_free(tcp_probe_ctx);
2470 return ret; 2543 return ret;