diff options
author | David Brodski <david@brodski.eu> | 2011-10-05 10:26:47 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2011-10-05 10:26:47 +0000 |
commit | 552822e316a49efe86bf64e61fdcb1bfc187c5d8 (patch) | |
tree | 9172b5fac69c969559b8f615b69eb5e918460242 /src/transport/plugin_transport_wlan.c | |
parent | cc632e434054d618798957fcdb1804f69c8dfc78 (diff) | |
download | gnunet-552822e316a49efe86bf64e61fdcb1bfc187c5d8.tar.gz gnunet-552822e316a49efe86bf64e61fdcb1bfc187c5d8.zip |
bugfix
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 505ca2839..dbc3e5493 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -65,7 +65,7 @@ | |||
65 | /** | 65 | /** |
66 | * scaling factor for hello beacon | 66 | * scaling factor for hello beacon |
67 | */ | 67 | */ |
68 | #define HALLO_BEACON_SCALING_FACTOR 30 | 68 | #define HELLO_BEACON_SCALING_FACTOR 30 |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * max size of fragment queue | 71 | * max size of fragment queue |
@@ -748,7 +748,7 @@ get_macendpoint (struct Plugin *plugin, const struct MacAddress *addr, | |||
748 | 748 | ||
749 | while (queue != NULL) | 749 | while (queue != NULL) |
750 | { | 750 | { |
751 | GNUNET_assert (queue->sessions_head != NULL); | 751 | //GNUNET_assert (queue->sessions_head != NULL); |
752 | if (memcmp (addr, &queue->addr, sizeof (struct MacAddress)) == 0) | 752 | if (memcmp (addr, &queue->addr, sizeof (struct MacAddress)) == 0) |
753 | return queue; /* session found */ | 753 | return queue; /* session found */ |
754 | queue = queue->next; | 754 | queue = queue->next; |
@@ -999,7 +999,7 @@ set_next_beacon_time (struct Plugin *const plugin) | |||
999 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 999 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
1000 | GNUNET_TIME_relative_multiply | 1000 | GNUNET_TIME_relative_multiply |
1001 | (GNUNET_TIME_UNIT_SECONDS, | 1001 | (GNUNET_TIME_UNIT_SECONDS, |
1002 | HALLO_BEACON_SCALING_FACTOR)); | 1002 | HELLO_BEACON_SCALING_FACTOR)); |
1003 | } | 1003 | } |
1004 | //under 30 known peers: every 10 seconds | 1004 | //under 30 known peers: every 10 seconds |
1005 | else if (plugin->mac_count < 30) | 1005 | else if (plugin->mac_count < 30) |
@@ -1008,7 +1008,7 @@ set_next_beacon_time (struct Plugin *const plugin) | |||
1008 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 1008 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
1009 | GNUNET_TIME_relative_multiply | 1009 | GNUNET_TIME_relative_multiply |
1010 | (GNUNET_TIME_UNIT_SECONDS, | 1010 | (GNUNET_TIME_UNIT_SECONDS, |
1011 | 10 * HALLO_BEACON_SCALING_FACTOR)); | 1011 | 10 * HELLO_BEACON_SCALING_FACTOR)); |
1012 | } | 1012 | } |
1013 | //over 30 known peers: once a minute | 1013 | //over 30 known peers: once a minute |
1014 | else | 1014 | else |
@@ -1017,7 +1017,7 @@ set_next_beacon_time (struct Plugin *const plugin) | |||
1017 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 1017 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
1018 | GNUNET_TIME_relative_multiply | 1018 | GNUNET_TIME_relative_multiply |
1019 | (GNUNET_TIME_UNIT_MINUTES, | 1019 | (GNUNET_TIME_UNIT_MINUTES, |
1020 | HALLO_BEACON_SCALING_FACTOR)); | 1020 | HELLO_BEACON_SCALING_FACTOR)); |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | 1023 | ||
@@ -1365,7 +1365,7 @@ add_message_for_send (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1365 | uint16_t size; | 1365 | uint16_t size; |
1366 | 1366 | ||
1367 | #if DEBUG_wlan_retransmission > 1 | 1367 | #if DEBUG_wlan_retransmission > 1 |
1368 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, | 1368 | GNUNET_loHELLO_BEACON_SCALING_FACTORg_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, |
1369 | "Adding fragment of message %p to send, session %p, endpoint %p, type %u\n", | 1369 | "Adding fragment of message %p to send, session %p, endpoint %p, type %u\n", |
1370 | fm, fm->session, endpoint, hdr->type); | 1370 | fm, fm->session, endpoint, hdr->type); |
1371 | #endif | 1371 | #endif |
@@ -1394,7 +1394,7 @@ add_message_for_send (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | /** | 1396 | /** |
1397 | * function to send a hallo beacon | 1397 | * function to send a hello beacon |
1398 | * @param plugin pointer to the plugin struct | 1398 | * @param plugin pointer to the plugin struct |
1399 | */ | 1399 | */ |
1400 | static void | 1400 | static void |
@@ -1408,7 +1408,7 @@ send_hello_beacon (struct Plugin *plugin) | |||
1408 | 1408 | ||
1409 | uint16_t size; | 1409 | uint16_t size; |
1410 | ssize_t bytes; | 1410 | ssize_t bytes; |
1411 | uint16_t hallo_size; | 1411 | uint16_t hello_size; |
1412 | struct GNUNET_MessageHeader *msgheader; | 1412 | struct GNUNET_MessageHeader *msgheader; |
1413 | struct ieee80211_frame *ieeewlanheader; | 1413 | struct ieee80211_frame *ieeewlanheader; |
1414 | struct Radiotap_Send *radioHeader; | 1414 | struct Radiotap_Send *radioHeader; |
@@ -1420,11 +1420,11 @@ send_hello_beacon (struct Plugin *plugin) | |||
1420 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello beacons send"), 1, GNUNET_NO); | 1420 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello beacons send"), 1, GNUNET_NO); |
1421 | 1421 | ||
1422 | hello = plugin->env->get_our_hello (); | 1422 | hello = plugin->env->get_our_hello (); |
1423 | hallo_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello); | 1423 | hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello); |
1424 | GNUNET_assert (sizeof (struct WlanHeader) + hallo_size <= WLAN_MTU); | 1424 | GNUNET_assert (sizeof (struct WlanHeader) + hello_size <= WLAN_MTU); |
1425 | size = | 1425 | size = |
1426 | sizeof (struct GNUNET_MessageHeader) + sizeof (struct Radiotap_Send) + | 1426 | sizeof (struct GNUNET_MessageHeader) + sizeof (struct Radiotap_Send) + |
1427 | sizeof (struct ieee80211_frame) + hallo_size; | 1427 | sizeof (struct ieee80211_frame) + hello_size; |
1428 | 1428 | ||
1429 | msgheader = GNUNET_malloc (size); | 1429 | msgheader = GNUNET_malloc (size); |
1430 | msgheader->size = htons (size); | 1430 | msgheader->size = htons (size); |
@@ -1441,7 +1441,7 @@ send_hello_beacon (struct Plugin *plugin) | |||
1441 | sizeof (struct GNUNET_MessageHeader)); | 1441 | sizeof (struct GNUNET_MessageHeader)); |
1442 | 1442 | ||
1443 | msgheader2->type = htons (GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);*/ | 1443 | msgheader2->type = htons (GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);*/ |
1444 | memcpy (msgheader2, hello, hallo_size); | 1444 | memcpy (msgheader2, hello, hello_size); |
1445 | 1445 | ||
1446 | bytes = GNUNET_DISK_file_write (plugin->server_stdin_handle, msgheader, size); | 1446 | bytes = GNUNET_DISK_file_write (plugin->server_stdin_handle, msgheader, size); |
1447 | 1447 | ||
@@ -1559,12 +1559,12 @@ check_fragment_queue (struct Plugin *plugin) | |||
1559 | if (session != NULL) | 1559 | if (session != NULL) |
1560 | { | 1560 | { |
1561 | pm = session->pending_message_head; | 1561 | pm = session->pending_message_head; |
1562 | GNUNET_assert (pm != NULL); | ||
1562 | GNUNET_CONTAINER_DLL_remove (session->pending_message_head, | 1563 | GNUNET_CONTAINER_DLL_remove (session->pending_message_head, |
1563 | session->pending_message_tail, pm); | 1564 | session->pending_message_tail, pm); |
1564 | session->mac->fragment_messages_out_count++; | 1565 | session->mac->fragment_messages_out_count++; |
1565 | session->fragment_messages_out_count++; | 1566 | session->fragment_messages_out_count++; |
1566 | plugin->pending_Fragment_Messages++; | 1567 | plugin->pending_Fragment_Messages++; |
1567 | GNUNET_assert (pm != NULL); | ||
1568 | 1568 | ||
1569 | fm = GNUNET_malloc (sizeof (struct FragmentMessage)); | 1569 | fm = GNUNET_malloc (sizeof (struct FragmentMessage)); |
1570 | fm->session = session; | 1570 | fm->session = session; |
@@ -1771,9 +1771,14 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1771 | _ | 1771 | _ |
1772 | ("Error writing to wlan healper. errno == %d, ERROR: %s\n"), | 1772 | ("Error writing to wlan healper. errno == %d, ERROR: %s\n"), |
1773 | errno, strerror (errno)); | 1773 | errno, strerror (errno)); |
1774 | 1774 | //TODO START NEW WLAN HELPER | |
1775 | /* | ||
1776 | * alle sessions beenden | ||
1777 | * neu starten (alle 5 sec) | ||
1778 | * alles bis dahin ablehnen | ||
1779 | */ | ||
1775 | } | 1780 | } |
1776 | GNUNET_assert (bytes != GNUNET_SYSERR); | 1781 | //GNUNET_assert (bytes != GNUNET_SYSERR); |
1777 | 1782 | ||
1778 | if (bytes != fm->size) | 1783 | if (bytes != fm->size) |
1779 | { | 1784 | { |
@@ -2058,15 +2063,19 @@ free_session (struct Plugin *plugin, struct Sessionqueue *queue, | |||
2058 | 2063 | ||
2059 | GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail, | 2064 | GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail, |
2060 | queue); | 2065 | queue); |
2061 | 2066 | //Check that no ohter session on this endpoint for this session exits | |
2067 | GNUNET_assert(search_session(plugin, endpoint, &queue->content->target) == NULL); | ||
2062 | if (endpoint->sessions_head == NULL && do_free_macendpoint == GNUNET_YES) | 2068 | if (endpoint->sessions_head == NULL && do_free_macendpoint == GNUNET_YES) |
2063 | { | 2069 | { |
2064 | free_macendpoint (plugin, endpoint); | 2070 | free_macendpoint (plugin, endpoint); |
2071 | //check if no endpoint with the same address exists | ||
2072 | GNUNET_assert(get_macendpoint(plugin, &endpoint->addr, GNUNET_NO) == NULL); | ||
2065 | } | 2073 | } |
2066 | 2074 | ||
2067 | if (queue->content->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 2075 | if (queue->content->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
2068 | GNUNET_SCHEDULER_cancel (queue->content->timeout_task); | 2076 | GNUNET_SCHEDULER_cancel (queue->content->timeout_task); |
2069 | GNUNET_free (queue); | 2077 | GNUNET_free (queue); |
2078 | |||
2070 | check_fragment_queue (plugin); | 2079 | check_fragment_queue (plugin); |
2071 | } | 2080 | } |
2072 | 2081 | ||
@@ -2400,7 +2409,7 @@ wlan_data_helper (void *cls, struct Session_light *session_light, | |||
2400 | { | 2409 | { |
2401 | session_light->session = create_session (plugin, session_light->macendpoint, &tmpsource); | 2410 | session_light->session = create_session (plugin, session_light->macendpoint, &tmpsource); |
2402 | } | 2411 | } |
2403 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hallo messages received"), 1, GNUNET_NO); | 2412 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello messages received"), 1, GNUNET_NO); |
2404 | plugin->env->receive(plugin->env->cls,&session_light->session->target,hdr, NULL, 0, session_light->session, | 2413 | plugin->env->receive(plugin->env->cls,&session_light->session->target,hdr, NULL, 0, session_light->session, |
2405 | (const char *) &session_light->session->mac->addr, | 2414 | (const char *) &session_light->session->mac->addr, |
2406 | sizeof (session_light->session->mac->addr)); | 2415 | sizeof (session_light->session->mac->addr)); |