mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-22 15:07:26 +01:00
#3632: add overloads to ctor and connect() to allow passing a Poco::Net::StreamSocket/Poco::Net::SecureStreamSocket to enable TLS connections without introduding a direct dependency to NetSSL.
This commit is contained in:
parent
7cf1342d29
commit
d15755daa6
@ -87,6 +87,11 @@ public:
|
||||
Client(const Net::SocketAddress& addrs);
|
||||
/// Constructor which connects to the given Redis host/port.
|
||||
|
||||
Client(const Net::StreamSocket& socket);
|
||||
/// Constructor which connects using an existing TCP
|
||||
/// connection. This can be used to connect via TLS, if the
|
||||
/// given socket is a Poco::Net::SecureStreamSocket.
|
||||
|
||||
virtual ~Client();
|
||||
/// Destroys the Client.
|
||||
|
||||
@ -113,6 +118,11 @@ public:
|
||||
void connect(const Net::SocketAddress& addrs, const Timespan& timeout);
|
||||
/// Connects to the given Redis server.
|
||||
|
||||
void connect(const Net::StreamSocket& socket);
|
||||
/// Connects to the given Redis server using an existing TCP
|
||||
/// connection. This can be used to connect via TLS, if the
|
||||
/// given socket is a Poco::Net::SecureStreamSocket.
|
||||
|
||||
void disconnect();
|
||||
/// Disconnects from the Redis server.
|
||||
|
||||
|
@ -61,6 +61,16 @@ Client::Client(const Net::SocketAddress& addrs):
|
||||
}
|
||||
|
||||
|
||||
Client::Client(const Net::StreamSocket& socket):
|
||||
_address(),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_output(0)
|
||||
{
|
||||
connect(socket);
|
||||
}
|
||||
|
||||
|
||||
Client::~Client()
|
||||
{
|
||||
delete _input;
|
||||
@ -133,6 +143,18 @@ void Client::connect(const Net::SocketAddress& addrs, const Timespan& timeout)
|
||||
}
|
||||
|
||||
|
||||
void Client::connect(const Poco::Net::StreamSocket& socket)
|
||||
{
|
||||
poco_assert(! _input);
|
||||
poco_assert(! _output);
|
||||
|
||||
_address = socket.peerAddress();
|
||||
_socket = socket;
|
||||
_input = new RedisInputStream(_socket);
|
||||
_output = new RedisOutputStream(_socket);
|
||||
}
|
||||
|
||||
|
||||
void Client::disconnect()
|
||||
{
|
||||
delete _input;
|
||||
|
Loading…
x
Reference in New Issue
Block a user