Some errors fixed, new debug code.
authorDavid Brodski <david@brodski.eu>
Tue, 1 Feb 2011 12:01:07 +0000 (12:01 +0000)
committerDavid Brodski <david@brodski.eu>
Tue, 1 Feb 2011 12:01:07 +0000 (12:01 +0000)
src/transport/gnunet-transport-wlan-helper.c
src/transport/plugin_transport_wlan.c

index 11a7128c1dfad79645d7186b949f746147d64d97..650e013dfabab3bc5ab3fa237bea2c50a39f6abb 100644 (file)
@@ -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);
index d35ef7735a15ab126f307cda42ca13dbc636e741..5c9144a2faee0958e6417ac681234b142ec96926 100644 (file)
@@ -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
+
 }
 
 /**