From 6bec3bca00d8cad55a53485539d951038f07e69d Mon Sep 17 00:00:00 2001 From: David Brodski Date: Tue, 1 Feb 2011 12:01:07 +0000 Subject: [PATCH] Some errors fixed, new debug code. --- src/transport/gnunet-transport-wlan-helper.c | 6 +-- src/transport/plugin_transport_wlan.c | 40 ++++++++++++++++++-- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c index 11a7128c1..650e013df 100644 --- a/src/transport/gnunet-transport-wlan-helper.c +++ b/src/transport/gnunet-transport-wlan-helper.c @@ -423,8 +423,8 @@ stdin_send (void *cls, struct sendbuf *write_pout = cls; int sendsize; struct GNUNET_MessageHeader newheader; - char * from; - char * to; + volatile char * from; + volatile char * to; sendsize = ntohs(hdr->size) - sizeof(struct RadiotapHeader) ; @@ -447,7 +447,7 @@ stdin_send (void *cls, memcpy(to, &newheader, sizeof(struct GNUNET_MessageHeader)); write_pout->size += sizeof(struct GNUNET_MessageHeader); - from = (char *) hdr + sizeof(struct RadiotapHeader) + sizeof(struct GNUNET_MessageHeader); + from = ((char *) hdr) + sizeof(struct RadiotapHeader) + sizeof(struct GNUNET_MessageHeader); to = write_pout->buf + write_pout->size; memcpy(to, from, sendsize - sizeof(struct GNUNET_MessageHeader)); write_pout->size += sendsize - sizeof(struct GNUNET_MessageHeader); diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index d35ef7735..5c9144a2f 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -1040,7 +1040,7 @@ do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct IeeeHeader * ieeewlanheader = NULL; struct RadiotapHeader * radioHeader = NULL; struct GNUNET_MessageHeader * msgheader = NULL; - struct GNUNET_MessageHeader * msgheader2 = NULL; + struct FragmentationHeader fragheader; struct FragmentationHeader * fragheaderptr = NULL; struct Finish_send * finish = NULL; @@ -1050,6 +1050,9 @@ do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) uint copyoffset = 0; struct AckQueue * akt = NULL; +#if 0 + struct GNUNET_MessageHeader * msgheader2 = NULL; + //test if a "hello-beacon" has to be send if (GNUNET_TIME_absolute_get_remaining(plugin->beacon_time).rel_value == 0) { @@ -1100,6 +1103,8 @@ do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } +#endif + fm = plugin->pending_Fragment_Messages_head; GNUNET_assert(fm != NULL); session = fm->session; @@ -1860,7 +1865,7 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h session_light->session = search_session(plugin, session_light->addr); } session = session_light->session; - wlanheader = (struct WlanHeader *) &hdr; + wlanheader = (struct WlanHeader *) hdr; tempmsg = (char*) &wlanheader[1]; temp_hdr = (const struct GNUNET_MessageHeader *) &wlanheader[1]; @@ -1871,6 +1876,11 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h return; } +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "After crc\n"); +#endif + //if not in session list if (session == NULL) { @@ -1878,6 +1888,10 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h //try if it is a hello message if (ntohs(temp_hdr->type) == GNUNET_MESSAGE_TYPE_HELLO) { +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "New WLAN Client\n"); +#endif session = create_session(plugin, session_light->addr); session_light->session = session; GNUNET_assert(GNUNET_HELLO_get_id( @@ -1892,15 +1906,30 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h return; } } + +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "After session\n"); +#endif + //"receive" the message struct GNUNET_TRANSPORT_ATS_Information distance[2]; distance[0].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); distance[0].value = htonl(1); distance[1].type = htonl(GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); distance[1].value = htonl(0); - plugin->env->receive(plugin, &session->target, temp_hdr, +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "After Information\n"); +#endif + plugin->env->receive(plugin, &(session->target), temp_hdr, (const struct GNUNET_TRANSPORT_ATS_Information *) &distance, 2, session, session->addr, sizeof(session->addr)); +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "After receive\n"); +#endif + } else if (ntohs(hdr->type) == GNUNET_MESSAGE_TYPE_WLAN_FRAGMENT) @@ -2052,6 +2081,11 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h return; } +#if DEBUG_wlan + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "Helper finished\n"); +#endif + } /** -- 2.25.1