diff options
author | David Brodski <david@brodski.eu> | 2011-09-21 19:38:19 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2011-09-21 19:38:19 +0000 |
commit | d3efb620d2503fce79fb4772ce6cc5eefde3a740 (patch) | |
tree | e3562491fe5526bf7da14b7605cd94adb78e55c4 /src/transport/plugin_transport_wlan.c | |
parent | cdaabfb92e4a9148c49888e814a428421eab29f3 (diff) | |
download | gnunet-d3efb620d2503fce79fb4772ce6cc5eefde3a740.tar.gz gnunet-d3efb620d2503fce79fb4772ce6cc5eefde3a740.zip |
Some asserts
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 07e61c4c5..0ac61f09d 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -832,6 +832,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
832 | struct Sessionqueue *queue = cls; | 832 | struct Sessionqueue *queue = cls; |
833 | 833 | ||
834 | GNUNET_assert (queue != NULL); | 834 | GNUNET_assert (queue != NULL); |
835 | GNUNET_assert(queue->content != NULL); | ||
835 | queue->content->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 836 | queue->content->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
836 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 837 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
837 | { | 838 | { |
@@ -841,6 +842,9 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
841 | (GNUNET_TIME_absolute_add | 842 | (GNUNET_TIME_absolute_add |
842 | (queue->content->last_activity, SESSION_TIMEOUT)).rel_value == 0) | 843 | (queue->content->last_activity, SESSION_TIMEOUT)).rel_value == 0) |
843 | { | 844 | { |
845 | |||
846 | GNUNET_assert(queue->content->mac != NULL); | ||
847 | GNUNET_assert(queue->content->mac->plugin != NULL); | ||
844 | GNUNET_STATISTICS_update (queue->content->mac->plugin->env->stats, _("# wlan session timeouts"), 1, GNUNET_NO); | 848 | GNUNET_STATISTICS_update (queue->content->mac->plugin->env->stats, _("# wlan session timeouts"), 1, GNUNET_NO); |
845 | free_session (queue->content->mac->plugin, queue, GNUNET_YES); | 849 | free_session (queue->content->mac->plugin, queue, GNUNET_YES); |
846 | } | 850 | } |
@@ -865,6 +869,7 @@ create_session (struct Plugin *plugin, struct MacEndpoint *endpoint, | |||
865 | const struct GNUNET_PeerIdentity *peer) | 869 | const struct GNUNET_PeerIdentity *peer) |
866 | { | 870 | { |
867 | GNUNET_assert (endpoint != NULL); | 871 | GNUNET_assert (endpoint != NULL); |
872 | GNUNET_assert (plugin != NULL); | ||
868 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan session created"), 1, GNUNET_NO); | 873 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan session created"), 1, GNUNET_NO); |
869 | struct Sessionqueue *queue = | 874 | struct Sessionqueue *queue = |
870 | GNUNET_malloc (sizeof (struct Sessionqueue) + sizeof (struct Session)); | 875 | GNUNET_malloc (sizeof (struct Sessionqueue) + sizeof (struct Session)); |
@@ -1405,6 +1410,8 @@ send_hello_beacon (struct Plugin *plugin) | |||
1405 | struct GNUNET_MessageHeader *msgheader2; | 1410 | struct GNUNET_MessageHeader *msgheader2; |
1406 | const struct GNUNET_MessageHeader *hello; | 1411 | const struct GNUNET_MessageHeader *hello; |
1407 | 1412 | ||
1413 | GNUNET_assert (plugin != NULL); | ||
1414 | |||
1408 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello beacons send"), 1, GNUNET_NO); | 1415 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello beacons send"), 1, GNUNET_NO); |
1409 | 1416 | ||
1410 | hello = plugin->env->get_our_hello (); | 1417 | hello = plugin->env->get_our_hello (); |
@@ -1621,6 +1628,7 @@ send_ack (struct Plugin *plugin, struct AckSendQueue *ack) | |||
1621 | ntohs (ack->hdr->size) - sizeof (struct Radiotap_Send)); | 1628 | ntohs (ack->hdr->size) - sizeof (struct Radiotap_Send)); |
1622 | #endif | 1629 | #endif |
1623 | 1630 | ||
1631 | GNUNET_assert (plugin != NULL); | ||
1624 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan acks send"), 1, GNUNET_NO); | 1632 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan acks send"), 1, GNUNET_NO); |
1625 | 1633 | ||
1626 | getRadiotapHeader (plugin, ack->endpoint, ack->radioHeader); | 1634 | getRadiotapHeader (plugin, ack->endpoint, ack->radioHeader); |
@@ -1696,6 +1704,7 @@ static void | |||
1696 | do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1704 | do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1697 | { | 1705 | { |
1698 | struct Plugin *plugin = cls; | 1706 | struct Plugin *plugin = cls; |
1707 | GNUNET_assert (plugin != NULL); | ||
1699 | 1708 | ||
1700 | plugin->server_write_task = GNUNET_SCHEDULER_NO_TASK; | 1709 | plugin->server_write_task = GNUNET_SCHEDULER_NO_TASK; |
1701 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1710 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
@@ -1866,7 +1875,7 @@ wlan_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | |||
1866 | struct Plugin *plugin = cls; | 1875 | struct Plugin *plugin = cls; |
1867 | struct PendingMessage *newmsg; | 1876 | struct PendingMessage *newmsg; |
1868 | struct WlanHeader *wlanheader; | 1877 | struct WlanHeader *wlanheader; |
1869 | 1878 | GNUNET_assert (plugin != NULL); | |
1870 | //check if msglen > 0 | 1879 | //check if msglen > 0 |
1871 | GNUNET_assert (msgbuf_size > 0); | 1880 | GNUNET_assert (msgbuf_size > 0); |
1872 | 1881 | ||
@@ -2165,6 +2174,8 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
2165 | struct GNUNET_PeerIdentity tmpsource; | 2174 | struct GNUNET_PeerIdentity tmpsource; |
2166 | int crc; | 2175 | int crc; |
2167 | 2176 | ||
2177 | GNUNET_assert (plugin != NULL); | ||
2178 | |||
2168 | if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_WLAN_DATA) | 2179 | if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_WLAN_DATA) |
2169 | { | 2180 | { |
2170 | 2181 | ||
@@ -2347,6 +2358,8 @@ wlan_data_helper (void *cls, struct Session_light *session_light, | |||
2347 | struct FragmentMessage *fm2; | 2358 | struct FragmentMessage *fm2; |
2348 | struct GNUNET_PeerIdentity tmpsource; | 2359 | struct GNUNET_PeerIdentity tmpsource; |
2349 | 2360 | ||
2361 | GNUNET_assert(plugin != NULL); | ||
2362 | |||
2350 | //ADVERTISEMENT | 2363 | //ADVERTISEMENT |
2351 | if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_HELLO) | 2364 | if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_HELLO) |
2352 | { | 2365 | { |
@@ -2412,6 +2425,7 @@ wlan_data_helper (void *cls, struct Session_light *session_light, | |||
2412 | session_light->addr.mac, | 2425 | session_light->addr.mac, |
2413 | 6)); | 2426 | 6)); |
2414 | #endif | 2427 | #endif |
2428 | |||
2415 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan fragments received"), 1, GNUNET_NO); | 2429 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan fragments received"), 1, GNUNET_NO); |
2416 | int ret = | 2430 | int ret = |
2417 | GNUNET_DEFRAGMENT_process_fragment (session_light->macendpoint->defrag, | 2431 | GNUNET_DEFRAGMENT_process_fragment (session_light->macendpoint->defrag, |
@@ -2556,6 +2570,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2556 | (GNUNET_TIME_absolute_add | 2570 | (GNUNET_TIME_absolute_add |
2557 | (endpoint->last_activity, MACENDPOINT_TIMEOUT)).rel_value == 0) | 2571 | (endpoint->last_activity, MACENDPOINT_TIMEOUT)).rel_value == 0) |
2558 | { | 2572 | { |
2573 | GNUNET_assert(endpoint->plugin != NULL); | ||
2559 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# wlan mac endpoints timeouts"), 1, GNUNET_NO); | 2574 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# wlan mac endpoints timeouts"), 1, GNUNET_NO); |
2560 | free_macendpoint (endpoint->plugin, endpoint); | 2575 | free_macendpoint (endpoint->plugin, endpoint); |
2561 | } | 2576 | } |
@@ -2578,6 +2593,7 @@ create_macendpoint (struct Plugin *plugin, const struct MacAddress *addr) | |||
2578 | { | 2593 | { |
2579 | struct MacEndpoint *newend = GNUNET_malloc (sizeof (struct MacEndpoint)); | 2594 | struct MacEndpoint *newend = GNUNET_malloc (sizeof (struct MacEndpoint)); |
2580 | 2595 | ||
2596 | GNUNET_assert(plugin != NULL); | ||
2581 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan mac endpoints created"), 1, GNUNET_NO); | 2597 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan mac endpoints created"), 1, GNUNET_NO); |
2582 | newend->addr = *addr; | 2598 | newend->addr = *addr; |
2583 | newend->plugin = plugin; | 2599 | newend->plugin = plugin; |
@@ -2623,6 +2639,7 @@ wlan_process_helper (void *cls, void *client, | |||
2623 | int datasize = 0; | 2639 | int datasize = 0; |
2624 | int pos; | 2640 | int pos; |
2625 | 2641 | ||
2642 | GNUNET_assert(plugin != NULL); | ||
2626 | switch (ntohs (hdr->type)) | 2643 | switch (ntohs (hdr->type)) |
2627 | { | 2644 | { |
2628 | case GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA: | 2645 | case GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA: |
@@ -2631,6 +2648,7 @@ wlan_process_helper (void *cls, void *client, | |||
2631 | "Func wlan_process_helper got GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA size: %u\n", | 2648 | "Func wlan_process_helper got GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA size: %u\n", |
2632 | ntohs (hdr->size)); | 2649 | ntohs (hdr->size)); |
2633 | #endif | 2650 | #endif |
2651 | |||
2634 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan WLAN_HELPER_DATA received"), 1, GNUNET_NO); | 2652 | GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan WLAN_HELPER_DATA received"), 1, GNUNET_NO); |
2635 | //call wlan_process_helper with the message inside, later with wlan: analyze signal | 2653 | //call wlan_process_helper with the message inside, later with wlan: analyze signal |
2636 | if (ntohs (hdr->size) < | 2654 | if (ntohs (hdr->size) < |