Renamed AsyncClient into AsyncReader

This commit is contained in:
fbraem
2015-11-02 22:08:27 +01:00
parent 93a2cced8d
commit cb8b6cfe8d
5 changed files with 150 additions and 174 deletions

View File

@@ -1,75 +0,0 @@
//
// AsyncClient.cpp
//
// $Id$
//
// Library: Redis
// Package: Redis
// Module: AsyncClient
//
// Implementation of the AsyncClient class.
//
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Redis/AsyncClient.h"
namespace Poco {
namespace Redis {
AsyncClient::AsyncClient() : Client(),
_activity(this, &AsyncClient::runActivity)
{
}
AsyncClient::AsyncClient(const std::string& hostAndPort) : Client(hostAndPort),
_activity(this, &AsyncClient::runActivity)
{
}
AsyncClient::AsyncClient(const std::string& host, int port) : Client(host, port),
_activity(this, &AsyncClient::runActivity)
{
}
AsyncClient::AsyncClient(const Net::SocketAddress& addrs) : Client(addrs),
_activity(this, &AsyncClient::runActivity)
{
}
AsyncClient::~AsyncClient()
{
stop();
}
void AsyncClient::runActivity()
{
while(!_activity.isStopped())
{
try
{
RedisType::Ptr reply = readReply();
redisResponse.notify(this, reply);
}
catch(TimeoutException&)
{
continue;
}
catch(Exception &)
{
stop();
}
}
}
} } // Poco::Redis

57
Redis/src/AsyncReader.cpp Normal file
View File

@@ -0,0 +1,57 @@
//
// AsyncReader.cpp
//
// $Id$
//
// Library: Redis
// Package: Redis
// Module: AsyncReader
//
// Implementation of the AsyncReader class.
//
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Redis/AsyncReader.h"
namespace Poco {
namespace Redis {
AsyncReader::AsyncReader(Client& client) : _client(client),
_activity(this, &AsyncReader::runActivity)
{
}
AsyncReader::~AsyncReader()
{
stop();
}
void AsyncReader::runActivity()
{
while(!_activity.isStopped())
{
try
{
RedisType::Ptr reply = _client.readReply();
redisResponse.notify(this, reply);
}
catch(TimeoutException&)
{
continue;
}
catch(Exception &)
{
stop();
}
}
}
} } // Poco::Redis