gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18038 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r18038 - gnunet/src/transport
Date: Mon, 7 Nov 2011 11:24:41 +0100

Author: brodski
Date: 2011-11-07 11:24:41 +0100 (Mon, 07 Nov 2011)
New Revision: 18038

Modified:
   gnunet/src/transport/plugin_transport_wlan.c
Log:
Made it impossible to start/stop the helper more then ones, should fix #1873

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2011-11-07 09:31:01 UTC 
(rev 18037)
+++ gnunet/src/transport/plugin_transport_wlan.c        2011-11-07 10:24:41 UTC 
(rev 18038)
@@ -314,6 +314,11 @@
    * Tracker for bandwidth limit
    */
   struct GNUNET_BANDWIDTH_Tracker tracker;
+
+  /**
+   * saves the current state of the helper process
+   */
+  int helper_is_running;
 };
 
 /**
@@ -1063,6 +1068,11 @@
 {
   struct GNUNET_TIME_Relative next_send;
 
+  //abort if helper is not running
+  if (plugin->helper_is_running == GNUNET_NO){
+      return;
+  }
+
   //cancel old task
   if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
   {
@@ -1490,6 +1500,14 @@
   char *filenameloopback = "gnunet-transport-wlan-helper-dummy";
   char *absolute_filename = NULL;
 
+  if (plugin->helper_is_running == GNUNET_YES){
+#if DEBUG_wlan
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
+                     "wlan_transport_start_wlan_helper not needed, helper 
already running!");
+#endif
+      return GNUNET_YES;
+  }
+
   plugin->server_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES);
   if (plugin->server_stdout == NULL)
     return GNUNET_SYSERR;
@@ -1633,6 +1651,7 @@
                                       plugin->server_stdout_handle,
                                       &wlan_plugin_helper_read, plugin);
 
+  plugin->helper_is_running = GNUNET_YES;
   return GNUNET_YES;
 }
 
@@ -1650,6 +1669,14 @@
                    "Stoping WLAN helper process\n");
 #endif
 
+  if (plugin->helper_is_running == GNUNET_NO){
+#if DEBUG_wlan
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
+                     "wlan_transport_stop_wlan_helper not needed, helper 
already stopped!");
+#endif
+      return GNUNET_YES;
+  }
+
   if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (plugin->server_write_delay_task);
@@ -1674,6 +1701,8 @@
   GNUNET_OS_process_wait (plugin->server_proc);
   GNUNET_OS_process_close (plugin->server_proc);
 
+  plugin->helper_is_running = GNUNET_NO;
+
   return GNUNET_YES;
 }
 
@@ -2181,8 +2210,11 @@
     return;
   }
 
-  GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME,
+#if 1
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
                    "do_transmit did nothing, should not happen!\n");
+#endif
+  set_next_send (plugin);
 }
 
 /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]