aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-25 19:05:42 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-25 19:05:42 +0000
commit64dfcb49f62761c471b0fecce8afdbdd459e0bb6 (patch)
tree995e71df7fe412410bbaa3c07a994f9e962aedc6
parent44aec022b5b54fb40af7e7226c6b5915735f694e (diff)
downloadgnunet-64dfcb49f62761c471b0fecce8afdbdd459e0bb6.tar.gz
gnunet-64dfcb49f62761c471b0fecce8afdbdd459e0bb6.zip
-add missing calls to monitor
-rw-r--r--src/transport/plugin_transport_wlan.c66
1 files changed, 45 insertions, 21 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index c78cfc9e1..a42f1a940 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -731,6 +731,9 @@ wlan_plugin_disconnect_session (void *cls,
731 plugin->env->session_end (plugin->env->cls, 731 plugin->env->session_end (plugin->env->cls,
732 session->address, 732 session->address,
733 session); 733 session);
734 notify_session_monitor (plugin,
735 session,
736 GNUNET_TRANSPORT_SS_DOWN);
734 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, 737 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head,
735 endpoint->sessions_tail, 738 endpoint->sessions_tail,
736 session); 739 session);
@@ -845,6 +848,9 @@ create_session (struct MacEndpoint *endpoint,
845 session->timeout_task = 848 session->timeout_task =
846 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout, 849 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout,
847 session); 850 session);
851 notify_session_monitor (plugin,
852 session,
853 GNUNET_TRANSPORT_SS_UP);
848 LOG (GNUNET_ERROR_TYPE_DEBUG, 854 LOG (GNUNET_ERROR_TYPE_DEBUG,
849 "Created new session %p for peer `%s' with endpoint %s\n", 855 "Created new session %p for peer `%s' with endpoint %s\n",
850 session, 856 session,
@@ -1050,7 +1056,8 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
1050 fm->cont_cls = cont_cls; 1056 fm->cont_cls = cont_cls;
1051 /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */ 1057 /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */
1052 fm->fragcontext = 1058 fm->fragcontext =
1053 GNUNET_FRAGMENT_context_create (plugin->env->stats, WLAN_MTU, 1059 GNUNET_FRAGMENT_context_create (plugin->env->stats,
1060 WLAN_MTU,
1054 &plugin->tracker, 1061 &plugin->tracker,
1055 endpoint->msg_delay, 1062 endpoint->msg_delay,
1056 endpoint->ack_delay, 1063 endpoint->ack_delay,
@@ -1161,7 +1168,8 @@ create_macendpoint (struct Plugin *plugin,
1161 pos->wlan_addr = (*mac); 1168 pos->wlan_addr = (*mac);
1162 pos->plugin = plugin; 1169 pos->plugin = plugin;
1163 pos->defrag = 1170 pos->defrag =
1164 GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, 1171 GNUNET_DEFRAGMENT_context_create (plugin->env->stats,
1172 WLAN_MTU,
1165 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, 1173 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC,
1166 pos, 1174 pos,
1167 &wlan_data_message_handler, 1175 &wlan_data_message_handler,
@@ -1392,14 +1400,19 @@ process_data (void *cls,
1392 GNUNET_STATISTICS_update (plugin->env->stats, 1400 GNUNET_STATISTICS_update (plugin->env->stats,
1393 _("# HELLO messages received via WLAN"), 1, 1401 _("# HELLO messages received via WLAN"), 1,
1394 GNUNET_NO); 1402 GNUNET_NO);
1395 1403 address = GNUNET_HELLO_address_allocate (&tmpsource,
1396 address = GNUNET_HELLO_address_allocate (&tmpsource, PLUGIN_NAME, 1404 PLUGIN_NAME,
1397 &mas->endpoint->wlan_addr, sizeof (mas->endpoint->wlan_addr), 1405 &mas->endpoint->wlan_addr,
1398 GNUNET_HELLO_ADDRESS_INFO_INBOUND); 1406 sizeof (mas->endpoint->wlan_addr),
1407 GNUNET_HELLO_ADDRESS_INFO_INBOUND);
1399 plugin->env->receive (plugin->env->cls, 1408 plugin->env->receive (plugin->env->cls,
1400 address, mas->session, hdr); 1409 address,
1410 mas->session,
1411 hdr);
1401 plugin->env->update_address_metrics (plugin->env->cls, 1412 plugin->env->update_address_metrics (plugin->env->cls,
1402 address, mas->session, &ats, 1); 1413 address,
1414 mas->session,
1415 &ats, 1);
1403 GNUNET_HELLO_address_free (address); 1416 GNUNET_HELLO_address_free (address);
1404 break; 1417 break;
1405 case GNUNET_MESSAGE_TYPE_FRAGMENT: 1418 case GNUNET_MESSAGE_TYPE_FRAGMENT:
@@ -1427,7 +1440,8 @@ process_data (void *cls,
1427 GNUNET_break (0); 1440 GNUNET_break (0);
1428 break; 1441 break;
1429 } 1442 }
1430 GNUNET_STATISTICS_update (plugin->env->stats, _("# ACKs received via WLAN"), 1443 GNUNET_STATISTICS_update (plugin->env->stats,
1444 _("# ACKs received via WLAN"),
1431 1, GNUNET_NO); 1445 1, GNUNET_NO);
1432 for (fm = mas->endpoint->sending_messages_head; NULL != fm; fm = fm->next) 1446 for (fm = mas->endpoint->sending_messages_head; NULL != fm; fm = fm->next)
1433 { 1447 {
@@ -1491,7 +1505,8 @@ process_data (void *cls,
1491 break; 1505 break;
1492 } 1506 }
1493 if (ntohl (wlanheader->crc) != 1507 if (ntohl (wlanheader->crc) !=
1494 GNUNET_CRYPTO_crc32_n (&wlanheader[1], msize - sizeof (struct WlanHeader))) 1508 GNUNET_CRYPTO_crc32_n (&wlanheader[1],
1509 msize - sizeof (struct WlanHeader)))
1495 { 1510 {
1496 GNUNET_STATISTICS_update (plugin->env->stats, 1511 GNUNET_STATISTICS_update (plugin->env->stats,
1497 _("# WLAN DATA messages discarded due to CRC32 error"), 1512 _("# WLAN DATA messages discarded due to CRC32 error"),
@@ -1503,16 +1518,21 @@ process_data (void *cls,
1503 if (NULL == (xmas.session = lookup_session (mas->endpoint, 1518 if (NULL == (xmas.session = lookup_session (mas->endpoint,
1504 &wlanheader->sender))) 1519 &wlanheader->sender)))
1505 { 1520 {
1506 xmas.session = create_session (mas->endpoint, &wlanheader->sender); 1521 xmas.session = create_session (mas->endpoint,
1522 &wlanheader->sender);
1507 address = GNUNET_HELLO_address_allocate (&wlanheader->sender, 1523 address = GNUNET_HELLO_address_allocate (&wlanheader->sender,
1508 PLUGIN_NAME, 1524 PLUGIN_NAME,
1509 &mas->endpoint->wlan_addr, 1525 &mas->endpoint->wlan_addr,
1510 sizeof (struct WlanAddress), 1526 sizeof (struct WlanAddress),
1511 GNUNET_HELLO_ADDRESS_INFO_NONE); 1527 GNUNET_HELLO_ADDRESS_INFO_NONE);
1512 plugin->env->session_start (NULL, address, xmas.session, NULL, 0); 1528 plugin->env->session_start (NULL,
1529 address,
1530 xmas.session,
1531 NULL, 0);
1513 LOG (GNUNET_ERROR_TYPE_DEBUG, 1532 LOG (GNUNET_ERROR_TYPE_DEBUG,
1514 "Notifying transport about peer `%s''s new session %p \n", 1533 "Notifying transport about peer `%s''s new session %p \n",
1515 GNUNET_i2s (&wlanheader->sender), xmas.session); 1534 GNUNET_i2s (&wlanheader->sender),
1535 xmas.session);
1516 GNUNET_HELLO_address_free (address); 1536 GNUNET_HELLO_address_free (address);
1517 } 1537 }
1518 LOG (GNUNET_ERROR_TYPE_DEBUG, 1538 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1851,12 +1871,14 @@ libgnunet_plugin_transport_wlan_done (void *cls)
1851 wa.options = htonl (plugin->options); 1871 wa.options = htonl (plugin->options);
1852 wa.mac = plugin->mac_address; 1872 wa.mac = plugin->mac_address;
1853 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, 1873 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
1854 PLUGIN_NAME, &wa, sizeof (struct WlanAddress), 1874 PLUGIN_NAME,
1855 GNUNET_HELLO_ADDRESS_INFO_NONE); 1875 &wa, sizeof (struct WlanAddress),
1876 GNUNET_HELLO_ADDRESS_INFO_NONE);
1856 1877
1857 plugin->env->notify_address (plugin->env->cls, GNUNET_NO, address); 1878 plugin->env->notify_address (plugin->env->cls,
1879 GNUNET_NO,
1880 address);
1858 plugin->have_mac = GNUNET_NO; 1881 plugin->have_mac = GNUNET_NO;
1859
1860 GNUNET_HELLO_address_free (address); 1882 GNUNET_HELLO_address_free (address);
1861 } 1883 }
1862 1884
@@ -1867,7 +1889,8 @@ libgnunet_plugin_transport_wlan_done (void *cls)
1867 } 1889 }
1868 if (NULL != plugin->suid_helper) 1890 if (NULL != plugin->suid_helper)
1869 { 1891 {
1870 GNUNET_HELPER_stop (plugin->suid_helper, GNUNET_NO); 1892 GNUNET_HELPER_stop (plugin->suid_helper,
1893 GNUNET_NO);
1871 plugin->suid_helper = NULL; 1894 plugin->suid_helper = NULL;
1872 } 1895 }
1873 endpoint_next = plugin->mac_head; 1896 endpoint_next = plugin->mac_head;
@@ -1923,7 +1946,7 @@ wlan_plugin_string_to_address (void *cls,
1923 char plugin[5]; 1946 char plugin[5];
1924 uint32_t options; 1947 uint32_t options;
1925 1948
1926 if ((NULL == addr) || (addrlen == 0)) 1949 if ((NULL == addr) || (0 == addrlen))
1927 { 1950 {
1928 GNUNET_break (0); 1951 GNUNET_break (0);
1929 return GNUNET_SYSERR; 1952 return GNUNET_SYSERR;
@@ -1942,7 +1965,8 @@ wlan_plugin_string_to_address (void *cls,
1942 if (8 != SSCANF (addr, 1965 if (8 != SSCANF (addr,
1943 "%4s.%u.%X:%X:%X:%X:%X:%X", 1966 "%4s.%u.%X:%X:%X:%X:%X:%X",
1944 plugin, &options, 1967 plugin, &options,
1945 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])) 1968 &a[0], &a[1], &a[2],
1969 &a[3], &a[4], &a[5]))
1946 { 1970 {
1947 GNUNET_break (0); 1971 GNUNET_break (0);
1948 return GNUNET_SYSERR; 1972 return GNUNET_SYSERR;
@@ -2007,7 +2031,7 @@ wlan_plugin_update_session_timeout (void *cls,
2007 const struct GNUNET_PeerIdentity *peer, 2031 const struct GNUNET_PeerIdentity *peer,
2008 struct Session *session) 2032 struct Session *session)
2009{ 2033{
2010 GNUNET_assert (session->timeout_task != GNUNET_SCHEDULER_NO_TASK); 2034 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != session->timeout_task);
2011 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2035 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
2012} 2036}
2013 2037