static void redisLibeventReadEvent(int fd, short event, void *arg) { ((void)fd); ((void)event); struct redisLibeventEvents *e = (struct redisLibeventEvents*)arg; if(e) { redisAsyncHandleRead(e->context); } }
void redisBoostClient::handle_read(boost::system::error_code ec) { read_in_progress_ = false; if(!ec) { redisAsyncHandleRead(context_); } if (!ec || ec == boost::asio::error::would_block) operate(); }
void RedisProxy::connect() { if(_connected) { return; } SLOG(DEBUG) << "redis connect begin..."; _context = redisAsyncConnect(_ip.c_str(), _port); if(!_context) { SLOG(WARNING) << "allocate redis async connection fail!"; return; } if(_context->err != 0) { SLOG(WARNING) << "connect fail[" << _context->err << "]"; redisAsyncFree(_context); _context = nullptr; return; } _context->data = this; _context->ev.data = this; _context->ev.addRead = RedisProxy::redis_add_read; _context->ev.delRead = RedisProxy::redis_del_read; _context->ev.addWrite = RedisProxy::redis_add_write; _context->ev.delWrite = RedisProxy::redis_del_write; _context->ev.cleanup = RedisProxy::redis_cleanup; _read_io = std::make_shared<IO>(_context->c.fd, EV_READ, false);//FIXME:add EV_ET in future _read_io->on_read([this]() { LOG(INFO) << "on read"; redisAsyncHandleRead(_context); }); _write_io = std::make_shared<IO>(_context->c.fd, EV_WRITE, false);//FIXME:add EV_ET in future LOG(INFO) << "redis fd:" << _context->c.fd; _write_io->on_write([this]() { LOG(INFO) << "on write"; redisAsyncHandleWrite(_context); }); _connected = get_local_loop()->add_io(_read_io, false) && get_local_loop()->add_io(_write_io, false); redisAsyncSetConnectCallback(_context, RedisProxy::handle_connect); redisAsyncSetDisconnectCallback(_context, RedisProxy::handle_disconnect); }
static int swoole_redis_onRead(swReactor *reactor, swEvent *event) { swRedisClient *redis = event->socket->object; redisAsyncHandleRead(redis->context); return SW_OK; }
void RedisNetlibReadEvent(void *callback_data, uint16_t msg, uint32_t handle, void *param) { LOG(TRACE) << "RedisNetlibReadEvent"; RedisNetlibEvents *event = static_cast<RedisNetlibEvents*>(callback_data); redisAsyncHandleRead(event->context); }
void ngx_redis_read_event_handler(ngx_event_t* handle) { //ngx_redis_context_t *e = (ngx_redis_context_t*)handle->data; redisAsyncHandleRead(ctx->context); }
void redis_nginx_read_event(ngx_event_t *ev) { ngx_connection_t *connection = (ngx_connection_t *) ev->data; redisAsyncHandleRead(connection->data); }