| 271 | }; |
| 272 | |
| 273 | static bool connect_server(acl::sslbase_conf* ssl_conf, IO_CTX* ctx, int id) |
| 274 | { |
| 275 | // ��ʼ�첽����Զ�̷����� |
| 276 | acl::aio_socket_stream* stream = acl::aio_socket_stream::open( |
| 277 | ctx->handle, ctx->addr, ctx->connect_timeout); |
| 278 | if (stream == NULL) |
| 279 | { |
| 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 | acl_non_blocking(stream->sock_handle(), ACL_BLOCKING); |
| 289 | |
| 290 | // �������Ӻ�Ļص������� |
| 291 | client_io_callback* callback = new |
| 292 | client_io_callback(stream, ssl_conf, ctx, id); |
| 293 | |
| 294 | // �������ӳɹ��Ļص������� |
| 295 | stream->add_open_callback(callback); |
| 296 | |
| 297 | // ��������ʧ�ܺ�ص������� |
| 298 | stream->add_close_callback(callback); |
| 299 | |
| 300 | // �������ӳ�ʱ�Ļص������� |
| 301 | stream->add_timeout_callback(callback); |
| 302 | |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | static void usage(const char* procname) |
| 307 | { |
no test coverage detected
searching dependent graphs…