| 272 | }; |
| 273 | |
| 274 | static bool connect_server(IO_CTX* ctx, int id) |
| 275 | { |
| 276 | // ��ʼ�첽����Զ�̷����� |
| 277 | acl::aio_socket_stream* stream = acl::aio_socket_stream::open |
| 278 | (ctx->handle, ctx->addr, ctx->connect_timeout); |
| 279 | if (stream == NULL) { |
| 280 | std::cout << "connect " << ctx->addr << " error!" << std::endl; |
| 281 | std::cout << "stoping ..." << std::endl; |
| 282 | if (id == 0) { |
| 283 | ctx->handle->stop(); |
| 284 | } |
| 285 | return false; |
| 286 | } |
| 287 | |
| 288 | // �������Ӻ�Ļص������� |
| 289 | client_io_callback* callback = new client_io_callback(ctx, stream, id); |
| 290 | |
| 291 | // �������ӳɹ��Ļص������� |
| 292 | stream->add_open_callback(callback); |
| 293 | |
| 294 | // ��������ʧ�ܺ�ص������� |
| 295 | stream->add_close_callback(callback); |
| 296 | |
| 297 | // �������ӳ�ʱ�Ļص������� |
| 298 | stream->add_timeout_callback(callback); |
| 299 | return true; |
| 300 | } |
| 301 | |
| 302 | static void usage(const char* procname) |
| 303 | { |
no test coverage detected
searching dependent graphs…