| 206 | }; |
| 207 | |
| 208 | static bool connect_server(IO_CTX* ctx, int id) |
| 209 | { |
| 210 | // ��ʼ�첽����Զ�̷����� |
| 211 | acl::aio_socket_stream* stream = acl::aio_socket_stream::open |
| 212 | (ctx->handle, ctx->addr, ctx->connect_timeout); |
| 213 | if (stream == NULL) { |
| 214 | std::cout << "connect " << ctx->addr << " error!" << std::endl; |
| 215 | std::cout << "stoping ..." << std::endl; |
| 216 | if (id == 0) |
| 217 | ctx->handle->stop(); |
| 218 | return false; |
| 219 | } |
| 220 | |
| 221 | // �������Ӻ�Ļص������� |
| 222 | client_io_callback* callback = new client_io_callback(ctx, stream, id); |
| 223 | |
| 224 | // �������ӳɹ��Ļص������� |
| 225 | stream->add_open_callback(callback); |
| 226 | |
| 227 | // ��������ʧ�ܺ�ص������� |
| 228 | stream->add_close_callback(callback); |
| 229 | |
| 230 | // �������ӳ�ʱ�Ļص������� |
| 231 | stream->add_timeout_callback(callback); |
| 232 | return true; |
| 233 | } |
| 234 | |
| 235 | static void usage(const char* procname) |
| 236 | { |
no test coverage detected
searching dependent graphs…