diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-25 21:09:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-25 21:09:44 +0000 |
commit | b0884b8bf35e3ec22471c7a264cc3d96a0bfea35 (patch) | |
tree | 3b4b34209c4f5f2e4f54cbe8e6965ea97ad0bfef /src/transport/plugin_transport_wlan.c | |
parent | 8df4e6722bdd65f50cf59c4c3d786d20b9564b4d (diff) | |
download | gnunet-b0884b8bf35e3ec22471c7a264cc3d96a0bfea35.tar.gz gnunet-b0884b8bf35e3ec22471c7a264cc3d96a0bfea35.zip |
always create session before giving performance metrics
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index b0be34346..51e8991b9 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1395,7 +1395,6 @@ process_data (void *cls, | |||
1395 | struct Plugin *plugin = cls; | 1395 | struct Plugin *plugin = cls; |
1396 | struct GNUNET_HELLO_Address *address; | 1396 | struct GNUNET_HELLO_Address *address; |
1397 | struct MacAndSession *mas = client; | 1397 | struct MacAndSession *mas = client; |
1398 | struct MacAndSession xmas; | ||
1399 | struct GNUNET_ATS_Information ats; | 1398 | struct GNUNET_ATS_Information ats; |
1400 | struct FragmentMessage *fm; | 1399 | struct FragmentMessage *fm; |
1401 | struct GNUNET_PeerIdentity tmpsource; | 1400 | struct GNUNET_PeerIdentity tmpsource; |
@@ -1448,6 +1447,17 @@ process_data (void *cls, | |||
1448 | &mas->endpoint->wlan_addr, | 1447 | &mas->endpoint->wlan_addr, |
1449 | sizeof (mas->endpoint->wlan_addr), | 1448 | sizeof (mas->endpoint->wlan_addr), |
1450 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | 1449 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); |
1450 | mas->session = lookup_session (mas->endpoint, | ||
1451 | &tmpsource); | ||
1452 | if (NULL == mas->session) | ||
1453 | { | ||
1454 | mas->session = create_session (mas->endpoint, | ||
1455 | &tmpsource); | ||
1456 | plugin->env->session_start (plugin->env->cls, | ||
1457 | address, | ||
1458 | mas->session, | ||
1459 | &ats, 1); | ||
1460 | } | ||
1451 | plugin->env->receive (plugin->env->cls, | 1461 | plugin->env->receive (plugin->env->cls, |
1452 | address, | 1462 | address, |
1453 | mas->session, | 1463 | mas->session, |
@@ -1557,34 +1567,34 @@ process_data (void *cls, | |||
1557 | GNUNET_NO); | 1567 | GNUNET_NO); |
1558 | break; | 1568 | break; |
1559 | } | 1569 | } |
1560 | xmas.endpoint = mas->endpoint; | 1570 | mas->session = lookup_session (mas->endpoint, |
1561 | if (NULL == (xmas.session = lookup_session (mas->endpoint, | 1571 | &wlanheader->sender); |
1562 | &wlanheader->sender))) | 1572 | if (NULL == mas->session) |
1563 | { | 1573 | { |
1564 | xmas.session = create_session (mas->endpoint, | 1574 | mas->session = create_session (mas->endpoint, |
1565 | &wlanheader->sender); | 1575 | &wlanheader->sender); |
1566 | address = GNUNET_HELLO_address_allocate (&wlanheader->sender, | 1576 | address = GNUNET_HELLO_address_allocate (&wlanheader->sender, |
1567 | PLUGIN_NAME, | 1577 | PLUGIN_NAME, |
1568 | &mas->endpoint->wlan_addr, | 1578 | &mas->endpoint->wlan_addr, |
1569 | sizeof (struct WlanAddress), | 1579 | sizeof (struct WlanAddress), |
1570 | GNUNET_HELLO_ADDRESS_INFO_NONE); | 1580 | GNUNET_HELLO_ADDRESS_INFO_NONE); |
1571 | plugin->env->session_start (NULL, | 1581 | plugin->env->session_start (plugin->env->cls, |
1572 | address, | 1582 | address, |
1573 | xmas.session, | 1583 | mas->session, |
1574 | NULL, 0); | 1584 | NULL, 0); |
1575 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1585 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1576 | "Notifying transport about peer `%s''s new session %p \n", | 1586 | "Notifying transport about peer `%s''s new session %p \n", |
1577 | GNUNET_i2s (&wlanheader->sender), | 1587 | GNUNET_i2s (&wlanheader->sender), |
1578 | xmas.session); | 1588 | mas->session); |
1579 | GNUNET_HELLO_address_free (address); | 1589 | GNUNET_HELLO_address_free (address); |
1580 | } | 1590 | } |
1581 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1591 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1582 | "Processing %u bytes of DATA from peer `%s'\n", | 1592 | "Processing %u bytes of DATA from peer `%s'\n", |
1583 | (unsigned int) msize, | 1593 | (unsigned int) msize, |
1584 | GNUNET_i2s (&wlanheader->sender)); | 1594 | GNUNET_i2s (&wlanheader->sender)); |
1585 | xmas.session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1595 | mas->session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1586 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, | 1596 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, |
1587 | &xmas, | 1597 | mas, |
1588 | (const char *) &wlanheader[1], | 1598 | (const char *) &wlanheader[1], |
1589 | msize - sizeof (struct WlanHeader), | 1599 | msize - sizeof (struct WlanHeader), |
1590 | GNUNET_YES, | 1600 | GNUNET_YES, |
@@ -2188,9 +2198,12 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
2188 | GNUNET_BANDWIDTH_value_init (100 * 1024 * | 2198 | GNUNET_BANDWIDTH_value_init (100 * 1024 * |
2189 | 1024 / 8), | 2199 | 1024 / 8), |
2190 | 100); | 2200 | 100); |
2191 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2201 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, |
2192 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2202 | plugin); |
2193 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 2203 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, |
2204 | plugin); | ||
2205 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, | ||
2206 | plugin); | ||
2194 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, | 2207 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, |
2195 | plugin); | 2208 | plugin); |
2196 | 2209 | ||