2012-06-10 16:50:54 +00:00
|
|
|
/*
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2014-11-02 12:12:05 +00:00
|
|
|
* Copyright (C) 2012 Synergy Si Ltd.
|
2012-06-10 16:50:54 +00:00
|
|
|
* Copyright (C) 2012 Nick Bolton
|
|
|
|
*
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2012-06-10 16:50:54 +00:00
|
|
|
*
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO: split this class into windows and unix to get rid
|
|
|
|
// of all the #ifdefs!
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "synergy/DaemonApp.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "synergy/App.h"
|
2014-10-23 11:09:09 +00:00
|
|
|
#include "synergy/ArgParser.h"
|
|
|
|
#include "synergy/ServerArgs.h"
|
|
|
|
#include "synergy/ClientArgs.h"
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "ipc/IpcClientProxy.h"
|
|
|
|
#include "ipc/IpcMessage.h"
|
|
|
|
#include "ipc/IpcLogOutputter.h"
|
|
|
|
#include "net/SocketMultiplexer.h"
|
|
|
|
#include "arch/XArch.h"
|
|
|
|
#include "base/Log.h"
|
|
|
|
#include "base/TMethodJob.h"
|
|
|
|
#include "base/TMethodEventJob.h"
|
|
|
|
#include "base/EventQueue.h"
|
|
|
|
#include "base/log_outputters.h"
|
|
|
|
#include "base/Log.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "arch/win32/ArchMiscWindows.h"
|
|
|
|
#include "arch/win32/XArchWindows.h"
|
|
|
|
#include "synergy/Screen.h"
|
|
|
|
#include "platform/MSWindowsScreen.h"
|
|
|
|
#include "platform/MSWindowsDebugOutputter.h"
|
|
|
|
#include "platform/MSWindowsWatchdog.h"
|
|
|
|
#include "platform/MSWindowsEventQueueBuffer.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp* DaemonApp::s_instance = NULL;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
mainLoopStatic()
|
|
|
|
{
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::s_instance->mainLoop(true);
|
2012-06-10 16:50:54 +00:00
|
|
|
return kExitSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
unixMainLoopStatic(int, const char**)
|
|
|
|
{
|
|
|
|
return mainLoopStatic();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
|
|
|
int
|
|
|
|
winMainLoopStatic(int, const char**)
|
|
|
|
{
|
2014-11-11 13:51:47 +00:00
|
|
|
return ArchMiscWindows::runDaemon(mainLoopStatic);
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::DaemonApp() :
|
2013-06-29 14:17:49 +00:00
|
|
|
m_ipcServer(nullptr),
|
2014-02-25 15:03:43 +00:00
|
|
|
m_ipcLogOutputter(nullptr),
|
2013-06-29 14:17:49 +00:00
|
|
|
#if SYSAPI_WIN32
|
2014-02-25 15:03:43 +00:00
|
|
|
m_watchdog(nullptr),
|
2013-06-29 14:17:49 +00:00
|
|
|
#endif
|
2014-10-27 14:11:43 +00:00
|
|
|
m_events(nullptr),
|
|
|
|
m_fileLogOutputter(nullptr)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
|
|
|
s_instance = this;
|
|
|
|
}
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::~DaemonApp()
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::run(int argc, char** argv)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
|
|
|
#if SYSAPI_WIN32
|
2012-07-10 01:51:51 +00:00
|
|
|
// win32 instance needed for threading, etc.
|
2014-11-11 13:51:47 +00:00
|
|
|
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
2012-06-10 16:50:54 +00:00
|
|
|
#endif
|
2012-07-10 01:51:51 +00:00
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
Arch arch;
|
2012-07-10 01:51:51 +00:00
|
|
|
arch.init();
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
Log log;
|
|
|
|
EventQueue events;
|
2013-06-29 14:17:49 +00:00
|
|
|
m_events = &events;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2012-07-10 01:51:51 +00:00
|
|
|
bool uninstall = false;
|
|
|
|
try
|
|
|
|
{
|
2012-06-10 16:50:54 +00:00
|
|
|
#if SYSAPI_WIN32
|
|
|
|
// sends debug messages to visual studio console window.
|
2014-11-12 11:44:29 +00:00
|
|
|
log.insert(new MSWindowsDebugOutputter());
|
2012-06-10 16:50:54 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// default log level to system setting.
|
2012-07-10 01:51:51 +00:00
|
|
|
string logLevel = arch.setting("LogLevel");
|
2012-06-10 16:50:54 +00:00
|
|
|
if (logLevel != "")
|
2012-07-10 01:51:51 +00:00
|
|
|
log.setFilter(logLevel.c_str());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
bool foreground = false;
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
string arg(argv[i]);
|
|
|
|
|
|
|
|
if (arg == "/f" || arg == "-f") {
|
|
|
|
foreground = true;
|
|
|
|
}
|
|
|
|
#if SYSAPI_WIN32
|
|
|
|
else if (arg == "/install") {
|
2012-07-05 21:26:41 +00:00
|
|
|
uninstall = true;
|
2012-07-10 01:51:51 +00:00
|
|
|
arch.installDaemon();
|
2012-06-10 16:50:54 +00:00
|
|
|
return kExitSuccess;
|
|
|
|
}
|
|
|
|
else if (arg == "/uninstall") {
|
2012-07-10 01:51:51 +00:00
|
|
|
arch.uninstallDaemon();
|
2012-06-10 16:50:54 +00:00
|
|
|
return kExitSuccess;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else {
|
|
|
|
stringstream ss;
|
|
|
|
ss << "Unrecognized argument: " << arg;
|
|
|
|
foregroundError(ss.str().c_str());
|
|
|
|
return kExitArgs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (foreground) {
|
|
|
|
// run process in foreground instead of daemonizing.
|
|
|
|
// useful for debugging.
|
|
|
|
mainLoop(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#if SYSAPI_WIN32
|
2012-07-10 01:51:51 +00:00
|
|
|
arch.daemonize("Synergy", winMainLoopStatic);
|
2012-06-10 16:50:54 +00:00
|
|
|
#elif SYSAPI_UNIX
|
2012-07-10 01:51:51 +00:00
|
|
|
arch.daemonize("Synergy", unixMainLoopStatic);
|
2012-06-10 16:50:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return kExitSuccess;
|
|
|
|
}
|
|
|
|
catch (XArch& e) {
|
2014-11-11 13:51:47 +00:00
|
|
|
String message = e.what();
|
|
|
|
if (uninstall && (message.find("The service has not been started") != String::npos)) {
|
2012-07-05 21:26:41 +00:00
|
|
|
// TODO: if we're keeping this use error code instead (what is it?!).
|
|
|
|
// HACK: this message happens intermittently, not sure where from but
|
|
|
|
// it's quite misleading for the user. they thing something has gone
|
|
|
|
// horribly wrong, but it's just the service manager reporting a false
|
|
|
|
// positive (the service has actually shut down in most cases).
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foregroundError(message.c_str());
|
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
return kExitFailed;
|
|
|
|
}
|
|
|
|
catch (std::exception& e) {
|
|
|
|
foregroundError(e.what());
|
|
|
|
return kExitFailed;
|
|
|
|
}
|
|
|
|
catch (...) {
|
|
|
|
foregroundError("Unrecognized error.");
|
|
|
|
return kExitFailed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::mainLoop(bool logToFile)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
DAEMON_RUNNING(true);
|
2013-10-15 15:46:02 +00:00
|
|
|
|
2014-10-27 14:11:43 +00:00
|
|
|
if (logToFile) {
|
2014-11-11 14:50:09 +00:00
|
|
|
m_fileLogOutputter = new FileLogOutputter(logFilename().c_str());
|
2014-10-27 14:11:43 +00:00
|
|
|
CLOG->insert(m_fileLogOutputter);
|
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2012-07-03 14:15:05 +00:00
|
|
|
// create socket multiplexer. this must happen after daemonization
|
|
|
|
// on unix because threads evaporate across a fork().
|
2014-11-11 13:51:47 +00:00
|
|
|
SocketMultiplexer multiplexer;
|
2012-07-03 14:15:05 +00:00
|
|
|
|
|
|
|
// uses event queue, must be created here.
|
2014-11-11 13:51:47 +00:00
|
|
|
m_ipcServer = new IpcServer(m_events, &multiplexer);
|
2012-07-03 14:15:05 +00:00
|
|
|
|
2012-07-05 18:05:35 +00:00
|
|
|
// send logging to gui via ipc, log system adopts outputter.
|
2015-07-13 10:00:10 +00:00
|
|
|
m_ipcLogOutputter = new IpcLogOutputter(*m_ipcServer, kIpcClientGui, true);
|
2012-07-05 18:05:35 +00:00
|
|
|
CLOG->insert(m_ipcLogOutputter);
|
2013-10-15 15:46:02 +00:00
|
|
|
|
2012-07-05 18:05:35 +00:00
|
|
|
#if SYSAPI_WIN32
|
2014-11-11 14:50:09 +00:00
|
|
|
m_watchdog = new MSWindowsWatchdog(false, *m_ipcServer, *m_ipcLogOutputter);
|
2014-10-27 14:11:43 +00:00
|
|
|
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
|
2012-07-05 18:05:35 +00:00
|
|
|
#endif
|
2013-10-15 15:46:02 +00:00
|
|
|
|
2013-06-29 14:17:49 +00:00
|
|
|
m_events->adoptHandler(
|
2014-11-11 13:51:47 +00:00
|
|
|
m_events->forIpcServer().messageReceived(), m_ipcServer,
|
|
|
|
new TMethodEventJob<DaemonApp>(this, &DaemonApp::handleIpcMessage));
|
2012-07-03 14:15:05 +00:00
|
|
|
|
|
|
|
m_ipcServer->listen();
|
2013-10-15 15:46:02 +00:00
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
#if SYSAPI_WIN32
|
2013-10-15 15:46:02 +00:00
|
|
|
|
|
|
|
// install the platform event queue to handle service stop events.
|
2014-11-12 11:44:29 +00:00
|
|
|
m_events->adoptBuffer(new MSWindowsEventQueueBuffer(m_events));
|
2012-07-28 02:59:20 +00:00
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
String command = ARCH->setting("Command");
|
2012-07-28 02:59:20 +00:00
|
|
|
bool elevate = ARCH->setting("Elevate") == "1";
|
2012-06-10 16:50:54 +00:00
|
|
|
if (command != "") {
|
|
|
|
LOG((CLOG_INFO "using last known command: %s", command.c_str()));
|
2013-10-15 10:04:27 +00:00
|
|
|
m_watchdog->setCommand(command, elevate);
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
2013-10-15 10:04:27 +00:00
|
|
|
m_watchdog->startAsync();
|
2012-06-10 16:50:54 +00:00
|
|
|
#endif
|
2013-06-29 14:17:49 +00:00
|
|
|
m_events->loop();
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
2013-10-15 10:04:27 +00:00
|
|
|
m_watchdog->stop();
|
|
|
|
delete m_watchdog;
|
2012-06-10 16:50:54 +00:00
|
|
|
#endif
|
|
|
|
|
2013-06-29 14:17:49 +00:00
|
|
|
m_events->removeHandler(
|
2014-11-11 13:51:47 +00:00
|
|
|
m_events->forIpcServer().messageReceived(), m_ipcServer);
|
2012-07-03 14:15:05 +00:00
|
|
|
|
2012-07-05 19:10:04 +00:00
|
|
|
CLOG->remove(m_ipcLogOutputter);
|
|
|
|
delete m_ipcLogOutputter;
|
2012-07-03 14:15:05 +00:00
|
|
|
delete m_ipcServer;
|
2013-10-15 15:46:02 +00:00
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
DAEMON_RUNNING(false);
|
|
|
|
}
|
|
|
|
catch (std::exception& e) {
|
2014-03-14 18:30:21 +00:00
|
|
|
LOG((CLOG_CRIT "An error occurred: %s", e.what()));
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
catch (...) {
|
2014-03-14 18:30:21 +00:00
|
|
|
LOG((CLOG_CRIT "An unknown error occurred.\n"));
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::foregroundError(const char* message)
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
|
|
|
#if SYSAPI_WIN32
|
|
|
|
MessageBox(NULL, message, "Synergy Service", MB_OK | MB_ICONERROR);
|
|
|
|
#elif SYSAPI_UNIX
|
|
|
|
cerr << message << endl;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::logFilename()
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2014-10-27 14:11:43 +00:00
|
|
|
string logFilename;
|
|
|
|
logFilename = ARCH->setting("LogFilename");
|
|
|
|
if (logFilename.empty()) {
|
|
|
|
logFilename = ARCH->getLogDirectory();
|
|
|
|
logFilename.append("/");
|
|
|
|
logFilename.append(LOG_FILENAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
return logFilename;
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
2012-07-03 14:15:05 +00:00
|
|
|
void
|
2014-11-11 13:51:47 +00:00
|
|
|
DaemonApp::handleIpcMessage(const Event& e, void*)
|
2012-07-03 14:15:05 +00:00
|
|
|
{
|
2014-11-11 13:51:47 +00:00
|
|
|
IpcMessage* m = static_cast<IpcMessage*>(e.getDataObject());
|
2012-07-10 01:51:51 +00:00
|
|
|
switch (m->type()) {
|
2012-07-03 14:15:05 +00:00
|
|
|
case kIpcCommand: {
|
2014-11-11 13:51:47 +00:00
|
|
|
IpcCommandMessage* cm = static_cast<IpcCommandMessage*>(m);
|
|
|
|
String command = cm->command();
|
2013-10-14 17:10:51 +00:00
|
|
|
|
|
|
|
// if empty quotes, clear.
|
|
|
|
if (command == "\"\"") {
|
|
|
|
command.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!command.empty()) {
|
|
|
|
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
std::vector<String> argsArray;
|
|
|
|
ArgParser::splitCommandString(command, argsArray);
|
|
|
|
ArgParser argParser(NULL);
|
2014-10-23 11:09:09 +00:00
|
|
|
const char** argv = argParser.getArgv(argsArray);
|
2014-11-11 13:51:47 +00:00
|
|
|
ServerArgs serverArgs;
|
|
|
|
ClientArgs clientArgs;
|
2014-10-23 11:09:09 +00:00
|
|
|
int argc = static_cast<int>(argsArray.size());
|
2014-11-11 13:51:47 +00:00
|
|
|
bool server = argsArray[0].find("synergys") != String::npos ? true : false;
|
|
|
|
ArgsBase* argBase = NULL;
|
2014-10-23 11:09:09 +00:00
|
|
|
|
|
|
|
if (server) {
|
|
|
|
argParser.parseServerArgs(serverArgs, argc, argv);
|
|
|
|
argBase = &serverArgs;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
argParser.parseClientArgs(clientArgs, argc, argv);
|
|
|
|
argBase = &clientArgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] argv;
|
2012-07-06 14:46:46 +00:00
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
String logLevel(argBase->m_logFilter);
|
2014-10-23 11:09:09 +00:00
|
|
|
if (!logLevel.empty()) {
|
2013-10-14 17:10:51 +00:00
|
|
|
try {
|
|
|
|
// change log level based on that in the command string
|
|
|
|
// and change to that log level now.
|
|
|
|
ARCH->setting("LogLevel", logLevel);
|
|
|
|
CLOG->setFilter(logLevel.c_str());
|
|
|
|
}
|
|
|
|
catch (XArch& e) {
|
2014-03-14 18:30:21 +00:00
|
|
|
LOG((CLOG_ERR "failed to save LogLevel setting, %s", e.what()));
|
2013-10-14 17:10:51 +00:00
|
|
|
}
|
2012-07-06 14:46:46 +00:00
|
|
|
}
|
2014-10-27 14:11:43 +00:00
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
2014-11-11 14:50:09 +00:00
|
|
|
String logFilename;
|
2014-10-27 14:11:43 +00:00
|
|
|
if (argBase->m_logFile != NULL) {
|
2014-11-11 14:50:09 +00:00
|
|
|
logFilename = String(argBase->m_logFile);
|
2014-10-27 14:11:43 +00:00
|
|
|
ARCH->setting("LogFilename", logFilename);
|
|
|
|
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
|
2014-11-11 14:50:09 +00:00
|
|
|
command = ArgParser::assembleCommand(argsArray, "--log", 1);
|
2014-10-27 14:11:43 +00:00
|
|
|
LOG((CLOG_DEBUG "removed log file argument and filename %s from command ", logFilename.c_str()));
|
|
|
|
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_watchdog->setFileLogOutputter(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_fileLogOutputter->setLogFilename(logFilename.c_str());
|
|
|
|
#endif
|
2012-07-06 14:46:46 +00:00
|
|
|
}
|
2013-10-14 17:10:51 +00:00
|
|
|
else {
|
|
|
|
LOG((CLOG_DEBUG "empty command, elevate=%d", cm->elevate()));
|
|
|
|
}
|
2012-07-06 14:46:46 +00:00
|
|
|
|
2012-07-03 14:15:05 +00:00
|
|
|
try {
|
|
|
|
// store command in system settings. this is used when the daemon
|
|
|
|
// next starts.
|
|
|
|
ARCH->setting("Command", command);
|
2012-07-28 02:59:20 +00:00
|
|
|
|
|
|
|
// TODO: it would be nice to store bools/ints...
|
2014-11-11 13:51:47 +00:00
|
|
|
ARCH->setting("Elevate", String(cm->elevate() ? "1" : "0"));
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
2012-07-03 14:15:05 +00:00
|
|
|
catch (XArch& e) {
|
2014-03-14 18:30:21 +00:00
|
|
|
LOG((CLOG_ERR "failed to save settings, %s", e.what()));
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
2012-07-10 18:35:33 +00:00
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
2012-06-10 16:50:54 +00:00
|
|
|
// tell the relauncher about the new command. this causes the
|
|
|
|
// relauncher to stop the existing command and start the new
|
|
|
|
// command.
|
2013-10-15 10:04:27 +00:00
|
|
|
m_watchdog->setCommand(command, cm->elevate());
|
2012-07-10 18:35:33 +00:00
|
|
|
#endif
|
2012-07-06 12:27:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-07-09 12:09:24 +00:00
|
|
|
|
|
|
|
case kIpcHello:
|
2014-11-11 13:51:47 +00:00
|
|
|
IpcHelloMessage* hm = static_cast<IpcHelloMessage*>(m);
|
|
|
|
String type;
|
2013-10-16 15:30:42 +00:00
|
|
|
switch (hm->clientType()) {
|
|
|
|
case kIpcClientGui: type = "gui"; break;
|
|
|
|
case kIpcClientNode: type = "node"; break;
|
|
|
|
default: type = "unknown"; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str()));
|
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
2014-11-11 13:51:47 +00:00
|
|
|
String watchdogStatus = m_watchdog->isProcessActive() ? "ok" : "error";
|
2013-10-16 15:30:42 +00:00
|
|
|
LOG((CLOG_INFO "watchdog status: %s", watchdogStatus.c_str()));
|
|
|
|
#endif
|
|
|
|
|
2012-07-09 12:09:24 +00:00
|
|
|
m_ipcLogOutputter->notifyBuffer();
|
|
|
|
break;
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
}
|