Example #1
0
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;
}
Example #2
0
bool CWakeOnAccess::WakeUpHost(const CURL& url)
{
  std::string hostName = url.GetHostName();

  if (!hostName.empty())
    return WakeUpHost (hostName, url.Get());
  return true;
}
Example #3
0
bool CWakeOnAccess::WakeUpHost(const std::string& hostName, const std::string& customMessage)
{
  return WakeUpHost(hostName, customMessage, false);
}