aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.c
diff options
context:
space:
mode:
authorDavid Brodski <david@brodski.eu>2011-11-07 10:24:41 +0000
committerDavid Brodski <david@brodski.eu>2011-11-07 10:24:41 +0000
commit262182d8d59db116c09ae428332f7e7fcc714267 (patch)
tree5473e3adcb25689cde995c8406f8566ec03502e7 /src/transport/plugin_transport_wlan.c
parent4ef5ef17a88923ddc570055fb5010dc2fcbfe5de (diff)
downloadgnunet-262182d8d59db116c09ae428332f7e7fcc714267.tar.gz
gnunet-262182d8d59db116c09ae428332f7e7fcc714267.zip
Made it impossible to start/stop the helper more then ones, should fix #1873
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r--src/transport/plugin_transport_wlan.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index cbab8cb0f..6d2310d49 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -314,6 +314,11 @@ struct Plugin
314 * Tracker for bandwidth limit 314 * Tracker for bandwidth limit
315 */ 315 */
316 struct GNUNET_BANDWIDTH_Tracker tracker; 316 struct GNUNET_BANDWIDTH_Tracker tracker;
317
318 /**
319 * saves the current state of the helper process
320 */
321 int helper_is_running;
317}; 322};
318 323
319/** 324/**
@@ -1063,6 +1068,11 @@ set_next_send (struct Plugin *const plugin)
1063{ 1068{
1064 struct GNUNET_TIME_Relative next_send; 1069 struct GNUNET_TIME_Relative next_send;
1065 1070
1071 //abort if helper is not running
1072 if (plugin->helper_is_running == GNUNET_NO){
1073 return;
1074 }
1075
1066 //cancel old task 1076 //cancel old task
1067 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK) 1077 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
1068 { 1078 {
@@ -1490,6 +1500,14 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin)
1490 char *filenameloopback = "gnunet-transport-wlan-helper-dummy"; 1500 char *filenameloopback = "gnunet-transport-wlan-helper-dummy";
1491 char *absolute_filename = NULL; 1501 char *absolute_filename = NULL;
1492 1502
1503 if (plugin->helper_is_running == GNUNET_YES){
1504#if DEBUG_wlan
1505 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
1506 "wlan_transport_start_wlan_helper not needed, helper already running!");
1507#endif
1508 return GNUNET_YES;
1509 }
1510
1493 plugin->server_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES); 1511 plugin->server_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES);
1494 if (plugin->server_stdout == NULL) 1512 if (plugin->server_stdout == NULL)
1495 return GNUNET_SYSERR; 1513 return GNUNET_SYSERR;
@@ -1633,6 +1651,7 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin)
1633 plugin->server_stdout_handle, 1651 plugin->server_stdout_handle,
1634 &wlan_plugin_helper_read, plugin); 1652 &wlan_plugin_helper_read, plugin);
1635 1653
1654 plugin->helper_is_running = GNUNET_YES;
1636 return GNUNET_YES; 1655 return GNUNET_YES;
1637} 1656}
1638 1657
@@ -1650,6 +1669,14 @@ wlan_transport_stop_wlan_helper (struct Plugin *plugin)
1650 "Stoping WLAN helper process\n"); 1669 "Stoping WLAN helper process\n");
1651#endif 1670#endif
1652 1671
1672 if (plugin->helper_is_running == GNUNET_NO){
1673#if DEBUG_wlan
1674 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
1675 "wlan_transport_stop_wlan_helper not needed, helper already stopped!");
1676#endif
1677 return GNUNET_YES;
1678 }
1679
1653 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK) 1680 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
1654 { 1681 {
1655 GNUNET_SCHEDULER_cancel (plugin->server_write_delay_task); 1682 GNUNET_SCHEDULER_cancel (plugin->server_write_delay_task);
@@ -1674,6 +1701,8 @@ wlan_transport_stop_wlan_helper (struct Plugin *plugin)
1674 GNUNET_OS_process_wait (plugin->server_proc); 1701 GNUNET_OS_process_wait (plugin->server_proc);
1675 GNUNET_OS_process_close (plugin->server_proc); 1702 GNUNET_OS_process_close (plugin->server_proc);
1676 1703
1704 plugin->helper_is_running = GNUNET_NO;
1705
1677 return GNUNET_YES; 1706 return GNUNET_YES;
1678} 1707}
1679 1708
@@ -2181,8 +2210,11 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2181 return; 2210 return;
2182 } 2211 }
2183 2212
2184 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME, 2213#if 1
2214 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2185 "do_transmit did nothing, should not happen!\n"); 2215 "do_transmit did nothing, should not happen!\n");
2216#endif
2217 set_next_send (plugin);
2186} 2218}
2187 2219
2188/** 2220/**