- pausing, unpausing
[oweals/gnunet.git] / src / transport / plugin_transport_wlan.c
index aed4b22861c88bb33ea7d2011468f27174c2731b..eb9732ac33b2540fe8cd74895365382c120462d6 100644 (file)
@@ -152,6 +152,11 @@ struct PendingMessage
  */
 struct Session
 {
+  /**
+   * To whom are we talking to (set to our identity
+   * if we are still waiting for the welcome message)
+   */
+  struct GNUNET_PeerIdentity target;
 
   /**
    * API requirement (must be first).
@@ -185,12 +190,6 @@ struct Session
    */
   struct PendingMessage *pending_message_tail;
 
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message)
-   */
-  struct GNUNET_PeerIdentity target;
-
   /**
    * When should this session time out?
    */
@@ -1286,7 +1285,8 @@ handle_helper_message (void *cls, void *client,
       /* remove old address */
       plugin->env->notify_address (plugin->env->cls, GNUNET_NO,
                                   &plugin->mac_address,
-                                  sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));      
+                                  sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress),
+                                  "wlan");
     }
     plugin->mac_address = cm->mac;
     plugin->have_mac = GNUNET_YES;
@@ -1296,7 +1296,8 @@ handle_helper_message (void *cls, void *client,
         GNUNET_i2s (plugin->env->my_identity));
     plugin->env->notify_address (plugin->env->cls, GNUNET_YES,
                                  &plugin->mac_address,
-                                 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
+                                 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress),
+                                 "wlan");
     break;
   case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER:
     LOG (GNUNET_ERROR_TYPE_DEBUG, 
@@ -1476,7 +1477,7 @@ wlan_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
     return NULL;
   }
   mac = addr;
-  return GNUNET_strdup (mac_to_string (mac));
+  return mac_to_string (mac);
 }
 
 
@@ -1538,6 +1539,16 @@ libgnunet_plugin_transport_wlan_done (void *cls)
     GNUNET_free (api);
     return NULL;
   }
+
+  if (GNUNET_YES == plugin->have_mac)
+  {
+      plugin->env->notify_address (plugin->env->cls, GNUNET_NO,
+                               &plugin->mac_address,
+                               sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress),
+                               "wlan");
+      plugin->have_mac = GNUNET_NO;
+  }
+
   if (GNUNET_SCHEDULER_NO_TASK != plugin->beacon_task)
   {
     GNUNET_SCHEDULER_cancel (plugin->beacon_task);
@@ -1711,27 +1722,33 @@ libgnunet_plugin_transport_wlan_init (void *cls)
     plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan";
     plugin->helper_argv[1] = interface;
     plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan",
+    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
+                                              "gnunet-helper-transport-wlan",
                                               plugin->helper_argv,
                                               &handle_helper_message,
+                                              NULL,
                                               plugin);
     break;
   case 1: /* testmode, peer 1 */
     plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
     plugin->helper_argv[1] = (char *) "1";
     plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy",
+    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
+                                              "gnunet-helper-transport-wlan-dummy",
                                               plugin->helper_argv,
                                               &handle_helper_message,
+                                              NULL,
                                               plugin);
     break;
   case 2: /* testmode, peer 2 */
     plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
     plugin->helper_argv[1] = (char *) "2";
     plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy",
+    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
+                                              "gnunet-helper-transport-wlan-dummy",
                                               plugin->helper_argv,
                                               &handle_helper_message,
+                                              NULL,
                                               plugin);
     break;
   default: