bool CWakeOnAccess::WakeUpHost (const std::string& hostName, const std::string& customMessage) { if (!IsEnabled()) return true; // bail if feature is turned off WakeUpEntry server; if (FindOrTouchHostEntry(hostName, server)) { CLog::Log(LOGNOTICE,"WakeOnAccess [%s] trigged by accessing : %s", hostName.c_str(), customMessage.c_str()); NestDetect nesting ; // detect recursive calls on gui thread.. if (nesting.IsNested()) // we might get in trouble if it gets called back in loop CLog::Log(LOGWARNING,"WakeOnAccess recursively called on gui-thread [%d]", NestDetect::Level()); bool ret = WakeUpHost(server); if (!ret) // extra log if we fail for some reason CLog::Log(LOGWARNING,"WakeOnAccess failed to bring up [%s] - there may be trouble ahead !", hostName.c_str()); TouchHostEntry(hostName); return ret; } return true; }
void CWakeOnAccess::WakeUpHost (const CStdString& hostName, const string& customMessage) { if (!IsEnabled()) return; // bail if feature is turned off WakeUpEntry server; if (FindOrTouchHostEntry(hostName, server)) { CLog::Log(LOGNOTICE,"WakeOnAccess [%s] trigged by accessing : %s", hostName.c_str(), customMessage.c_str()); NestDetect nesting ; // detect recursive calls on gui thread.. if (nesting.IsNested()) // we might get in trouble if it gets called back in loop CLog::Log(LOGWARNING,"WakeOnAccess recursively called on gui-thread [%d]", NestDetect::Level()); WakeUpHost(server); TouchHostEntry(hostName); } }