Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 1666e18

Browse files
author
hamidr
committed
No template class anymore
1 parent 6fbaa7a commit 1666e18

File tree

4 files changed

+183
-197
lines changed

4 files changed

+183
-197
lines changed

includes/monitor.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace async_redis
99
{
10-
template<typename InputOutputHandler>
1110
class monitor
1211
{
1312
using async_socket = network::async_socket;
@@ -25,19 +24,19 @@ namespace async_redis
2524
using parser_t = parser::redis_response::parser;
2625
using watcher_cb_t = std::function<void (const string&, parser_t, EventState)>;
2726

28-
monitor(InputOutputHandler &event_loop)
27+
monitor(event_loop::event_loop_ev &event_loop)
2928
: io_(event_loop)
3029
{}
3130

32-
void connect(typename async_socket::connect_handler_t handler, const std::string& ip, int port)
31+
void connect(async_socket::connect_handler_t handler, const std::string& ip, int port)
3332
{
3433
if (!socket_ || !socket_->is_valid())
3534
socket_ = std::make_unique<tcp_socket>(io_);
3635

3736
socket_->template async_connect<tcp_socket>(0, handler, ip, port);
3837
}
3938

40-
void connect(typename async_socket::connect_handler_t handler, const std::string& path)
39+
void connect(async_socket::connect_handler_t handler, const std::string& path)
4140
{
4241
if (!socket_ || !socket_->is_valid())
4342
socket_ = std::make_unique<unix_socket>(io_);
@@ -277,7 +276,7 @@ namespace async_redis
277276
std::unordered_map<std::string, watcher_cb_t> pwatchers_;
278277

279278
std::unique_ptr<async_socket> socket_;
280-
InputOutputHandler &io_;
279+
event_loop::event_loop_ev &io_;
281280
enum { max_data_size = 1024 };
282281
char data_[max_data_size];
283282
bool is_watching_ = false;

includes/redis_client.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
#include <memory>
66

77
#include "connection.hpp"
8-
#include "network/async_socket.hpp"
9-
#include "parser/redis_response.h"
108

119
namespace async_redis
1210
{
1311
using std::string;
1412

15-
template<typename InputOutputHandler>
1613
class redis_client
1714
{
1815
using reply_cb_t = connection::reply_cb_t;
@@ -22,13 +19,12 @@ namespace async_redis
2219
class connect_exception : std::exception {};
2320
using parser_t = connection::parser_t;
2421

25-
redis_client(InputOutputHandler &eventIO, int n = 1)
26-
: ev_loop_(eventIO)
22+
redis_client(event_loop::event_loop_ev &eventIO, int n = 1)
2723
{
2824
conn_pool_.reserve(n);
2925

3026
for (int i = 0; i < conn_pool_.capacity(); ++i)
31-
conn_pool_.push_back(std::make_unique<connection>(ev_loop_));
27+
conn_pool_.push_back(std::make_unique<connection>(eventIO));
3228
}
3329

3430
bool is_connected() const
@@ -176,6 +172,5 @@ namespace async_redis
176172
int con_rr_ctr_ = 0;
177173
int connected_called_ = 0;
178174
bool is_connected_ = false;
179-
InputOutputHandler& ev_loop_;
180175
};
181176
}

0 commit comments

Comments
 (0)