diff --git a/plugins/joy_to_twist/JoyToTwist.cc b/plugins/joy_to_twist/JoyToTwist.cc index bc72da7..bf83d18 100644 --- a/plugins/joy_to_twist/JoyToTwist.cc +++ b/plugins/joy_to_twist/JoyToTwist.cc @@ -22,6 +22,7 @@ #endif #include +#include #include #include diff --git a/plugins/websocket_server/WebsocketServer.cc b/plugins/websocket_server/WebsocketServer.cc index b146e28..ee768c8 100644 --- a/plugins/websocket_server/WebsocketServer.cc +++ b/plugins/websocket_server/WebsocketServer.cc @@ -624,9 +624,14 @@ void WebsocketServer::Run() while (this->run) { - // The second parameter is a timeout that is no longer used by - // libwebsockets. - lws_service(this->context, 0); + // The second parameter is used to control lws's event wait time. + // A -1 does not wait for an event, and 0 causes lws to wait + // for an event. When shutting down the websocket server, the + // wait time could be over 30 seconds if 0 is used. + // + // We are running lws in a separate thread with out our own + // condition variable. So, we will not use lws's event wait. + lws_service(this->context, -1); // Wait for (1/60) seconds or an event. std::unique_lock lock(this->runMutex); diff --git a/src/cmd/cmdlaunch.rb.in b/src/cmd/cmdlaunch.rb.in index d60e14b..d122f66 100755 --- a/src/cmd/cmdlaunch.rb.in +++ b/src/cmd/cmdlaunch.rb.in @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require 'pathname' # Constants. LIBRARY_VERSION = '@PROJECT_VERSION_FULL@' COMMANDS = { @@ -28,9 +29,8 @@ class Cmd command = args[0] exe_name = COMMANDS[command] - if exe_name[0] == '/' - # If the first character is a slash, we'll assume that we've been given an - # absolute path to the executable. This is only used during test mode. + if Pathname.new(exe_name).absolute? + # The exe_name can be absolute path during test. We'll leave it unchanged else # We're assuming that the library path is relative to the current # location of this script.