1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 02:53:13 +02:00

redis: check for socket errors when loading database on startup

This commit is contained in:
Adam
2017-03-16 20:13:56 -04:00
parent b2d028533d
commit 516ab164f6
3 changed files with 24 additions and 3 deletions
+9 -2
View File
@@ -157,6 +157,11 @@ class MyRedisService : public Provider
}
public:
bool IsSocketDead() anope_override
{
return this->sock && this->sock->flags[SF_DEAD];
}
void SendCommand(RedisSocket *s, Interface *i, const std::vector<Anope::string> &cmds)
{
std::vector<std::pair<const char *, size_t> > args;
@@ -201,9 +206,11 @@ class MyRedisService : public Provider
public:
bool BlockAndProcess() anope_override
{
this->sock->ProcessWrite();
if (!this->sock->ProcessWrite())
this->sock->flags[SF_DEAD] = true;
this->sock->SetBlocking(true);
this->sock->ProcessRead();
if (!this->sock->ProcessRead())
this->sock->flags[SF_DEAD] = true;
this->sock->SetBlocking(false);
return !this->sock->interfaces.empty();
}