1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 01:16:38 +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
+13 -1
View File
@@ -179,6 +179,12 @@ class DatabaseRedis : public Module, public Pipe
EventReturn OnLoadDatabase() anope_override
{
if (!redis)
{
Log(this) << "Unable to load database - unable to find redis provider";
return EVENT_CONTINUE;
}
const std::vector<Anope::string> type_order = Serialize::Type::GetTypeOrder();
for (unsigned i = 0; i < type_order.size(); ++i)
{
@@ -186,7 +192,13 @@ class DatabaseRedis : public Module, public Pipe
this->OnSerializeTypeCreate(sb);
}
while (redis->BlockAndProcess());
while (!redis->IsSocketDead() && redis->BlockAndProcess());
if (redis->IsSocketDead())
{
Log(this) << "I/O error while loading redis database - is it online?";
return EVENT_CONTINUE;
}
redis->Subscribe(&this->sl, "__keyspace@*__:hash:*");