diff options
-rw-r--r-- | remoting/host/posix/sighup_listener.cc (renamed from remoting/host/sighup_listener_mac.cc) | 3 | ||||
-rw-r--r-- | remoting/host/posix/sighup_listener.h (renamed from remoting/host/sighup_listener_mac.h) | 10 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 17 | ||||
-rw-r--r-- | remoting/remoting.gyp | 9 | ||||
-rwxr-xr-x | remoting/tools/me2me_virtual_host.py | 14 |
5 files changed, 31 insertions, 22 deletions
diff --git a/remoting/host/sighup_listener_mac.cc b/remoting/host/posix/sighup_listener.cc index 9613ba2..5a4ad07 100644 --- a/remoting/host/sighup_listener_mac.cc +++ b/remoting/host/posix/sighup_listener.cc @@ -4,9 +4,10 @@ // TODO(jamiewalch): Add unit tests for this. -#include "remoting/host/sighup_listener_mac.h" +#include "remoting/host/posix/sighup_listener.h" #include <errno.h> +#include <signal.h> #include "base/compiler_specific.h" #include "base/eintr_wrapper.h" diff --git a/remoting/host/sighup_listener_mac.h b/remoting/host/posix/sighup_listener.h index a068759..48140a3 100644 --- a/remoting/host/sighup_listener_mac.h +++ b/remoting/host/posix/sighup_listener.h @@ -3,11 +3,11 @@ // found in the LICENSE file. // // This file implements a signal handler that is used to safely handle SIGHUP -// and trigger the specified callback. It is currently used on Mac in order to -// reload the me2me host configuration, but would need minimal changes on Linux. +// and trigger the specified callback. It is used on Linux and Mac in order to +// reload the me2me host configuration. -#ifndef REMOTING_HOST_SIGHUP_LISTENER_MAC_H_ -#define REMOTING_HOST_SIGHUP_LISTENER_MAC_H_ +#ifndef REMOTING_HOST_POSIX_SIGHUP_LISTENER_H_ +#define REMOTING_HOST_POSIX_SIGHUP_LISTENER_H_ #include "base/callback_forward.h" @@ -19,4 +19,4 @@ bool RegisterHupSignalHandler(const base::Closure& callback); } // namespace remoting -#endif // REMOTING_HOST_SIGHUP_LISTENER_MAC_H_ +#endif // REMOTING_HOST_POSIX_SIGHUP_LISTENER_H_ diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 701ce32..53c14b3 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -49,19 +49,24 @@ #include "remoting/jingle_glue/xmpp_signal_strategy.h" #include "remoting/protocol/me2me_host_authenticator_factory.h" +#if defined(OS_POSIX) +#include "remoting/host/posix/sighup_listener.h" +#endif // defined(OS_POSIX) + #if defined(OS_MACOSX) #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsautorelease_pool.h" #include "remoting/host/curtain_mode_mac.h" -#include "remoting/host/sighup_listener_mac.h" -#endif +#endif // defined(OS_MACOSX) + // N.B. OS_WIN is defined by including src/base headers. #if defined(OS_WIN) #include <commctrl.h> -#endif +#endif // defined(OS_WIN) + #if defined(TOOLKIT_GTK) #include "ui/gfx/gtk_util.h" -#endif +#endif // defined(TOOLKIT_GTK) namespace { @@ -188,7 +193,7 @@ class HostProcess #endif // defined(OS_WIN) void ListenForConfigChanges() { -#if defined(OS_MACOSX) +#if defined(OS_POSIX) remoting::RegisterHupSignalHandler( base::Bind(&HostProcess::ConfigUpdatedDelayed, base::Unretained(this))); #elif defined(OS_WIN) @@ -200,7 +205,7 @@ class HostProcess if (!config_watcher_->Watch(host_config_path_, delegate)) { LOG(ERROR) << "Couldn't watch file " << host_config_path_.value(); } -#endif +#endif // defined (OS_WIN) } void CreateAuthenticatorFactory() { diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 6154111..36403a6 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -1492,8 +1492,8 @@ 'sources': [ 'host/branding.cc', 'host/branding.h', - 'host/sighup_listener_mac.cc', - 'host/sighup_listener_mac.h', + 'host/posix/sighup_listener.cc', + 'host/posix/sighup_listener.h', 'host/remoting_me2me_host.cc', 'host/usage_stats_consent.h', 'host/usage_stats_consent_win.cc', @@ -1501,6 +1501,11 @@ 'host/curtain_mode_mac.cc', ], 'conditions': [ + ['os_posix != 1', { + 'sources/': [ + ['exclude', '^host/posix/'], + ], + }], ['OS=="mac"', { 'mac_bundle': 1, 'conditions': [ diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py index 6b62d26..2b7016c 100755 --- a/remoting/tools/me2me_virtual_host.py +++ b/remoting/tools/me2me_virtual_host.py @@ -649,14 +649,12 @@ def cleanup(): def reload_config(): for desktop in g_desktops: if desktop.host_proc: - # Terminating the Host will cause the main loop to spawn another - # instance, which will read any changes made to the Host config file. - desktop.host_proc.terminate() + desktop.host_proc.send_signal(signal.SIGHUP) def signal_handler(signum, stackframe): - if signum == signal.SIGUSR1: - logging.info("SIGUSR1 caught, reloading configuration.") + if signum == signal.SIGHUP: + logging.info("SIGHUP caught, reloading configuration.") reload_config() else: # Exit cleanly so the atexit handler, cleanup(), gets called. @@ -712,7 +710,7 @@ def main(): running, pid = PidFile(pid_filename).check() if not running: return 1 - os.kill(pid, signal.SIGUSR1) + os.kill(pid, signal.SIGHUP) return 0 if not options.size: @@ -798,7 +796,7 @@ def main(): host.save_config(host_config) running, pid = PidFile(pid_filename).check() if running and pid != 0: - os.kill(pid, signal.SIGUSR1) + os.kill(pid, signal.SIGHUP) print "The running instance has been updated with the new PIN." return 0 @@ -908,7 +906,7 @@ def main(): pid, status = os.wait() except OSError, e: if e.errno == errno.EINTR: - # Retry on EINTR, which can happen if a signal such as SIGUSR1 is + # Retry on EINTR, which can happen if a signal such as SIGHUP is # received. continue else: |