Announcement protocol extension
This commit is contained in:
parent
b383a382eb
commit
22f642bb98
2 changed files with 21 additions and 0 deletions
|
@ -222,6 +222,23 @@ bool Client::close()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Client::handleAnnouncement(const rapidjson::Value ¶ms)
|
||||||
|
{
|
||||||
|
if (!params.IsObject())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.HasMember("message"))
|
||||||
|
{
|
||||||
|
LOG_INFO("[%s] announcement: \"%s\"", m_pool.url(),
|
||||||
|
params["message"].GetString());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Client::isCriticalError(const char *message)
|
bool Client::isCriticalError(const char *message)
|
||||||
{
|
{
|
||||||
|
@ -588,6 +605,9 @@ void Client::parseNotification(const char *method, const rapidjson::Value ¶m
|
||||||
m_listener->onJobReceived(this, m_job);
|
m_listener->onJobReceived(this, m_job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (strcmp(method, "announcement") == 0) {
|
||||||
|
handleAnnouncement(params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
bool close();
|
bool close();
|
||||||
|
bool handleAnnouncement(const rapidjson::Value ¶ms);
|
||||||
bool isCriticalError(const char *message);
|
bool isCriticalError(const char *message);
|
||||||
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
||||||
bool parseLogin(const rapidjson::Value &result, int *code);
|
bool parseLogin(const rapidjson::Value &result, int *code);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue