This repository was archived by the owner on Sep 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -163,21 +163,25 @@ namespace async_redis {
163163
164164 if (-1 == fcntl (fd_, F_SETFL, fcntl (fd_, F_GETFL) | O_NONBLOCK))
165165 throw nonblocking_socket_exception ();
166+
167+ id_ = io_.watch (fd_);
166168 }
167169
168170 // TODO: well i guess retry with create_socket in these functions
169171 int connect_to (socket_t * socket_addr, int len) {
170172 int ret = ::connect (fd_, socket_addr, len);
171- if (!ret) {
172- id_ = io_.watch (fd_);
173+ if (!ret)
173174 is_connected_ = true ;
174- }
175175
176176 return ret;
177177 }
178178
179179 int bind_to (socket_t * socket_addr, int len) {
180- return ::bind (fd_, socket_addr, len);
180+ int b = ::bind (fd_, socket_addr, len);
181+ if (!b)
182+ is_connected_ = true ;
183+
184+ return b;
181185 }
182186
183187 private:
Original file line number Diff line number Diff line change @@ -171,8 +171,8 @@ int main(int argc, char** args)
171171 event_loop_ev loop;
172172
173173 monitor_test monitor_mock (loop, 100000 );
174- // async_redis::tcp_server::tcp_server server(loop);
175- // server.listen(9090);
174+ async_redis::tcp_server::tcp_server server (loop);
175+ server.listen (9090 );
176176 // sentinel_test sentinel_mock(loop);
177177
178178 // using unix_socket_t = async_redis::network::unix_socket<event_loop_ev>;
@@ -332,7 +332,6 @@ int main(int argc, char** args)
332332 // //std::cout <<"hgetall hello " << parsed->to_string() << std::endl << std::endl;
333333 // });
334334
335- // //TODO:WTF?
336335 // // for(int i = 0; i< 100; ++i)
337336 // // client.set("n1"+i, "1", [](std::shared_ptr<IO::base_resp_parser> parsed) {
338337 // // // //std::cout<< "*" <<"set n1 " << parsed->to_string() <<"*"<< std::endl << std::endl;
You can’t perform that action at this time.
0 commit comments