mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
Renamed AsyncClient into AsyncReader
This commit is contained in:
@@ -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
57
Redis/src/AsyncReader.cpp
Normal 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
|
||||
Reference in New Issue
Block a user