* �����麯��, �����첽���ر�ʱ���ô˻ص����� */
| 100 | * �����麯��, �����첽���ر�ʱ���ô˻ص����� |
| 101 | */ |
| 102 | void close_callback() |
| 103 | { |
| 104 | if (!client_->is_opened()) { |
| 105 | std::cout << "Id: " << id_ << " connect " |
| 106 | << ctx_->addr << " error: " |
| 107 | << acl::last_serror(); |
| 108 | |
| 109 | // ����ǵ�һ�����Ӿ�ʧ�ܣ����˳� |
| 110 | if (ctx_->nopen_total == 0) { |
| 111 | std::cout << ", first connect error, quit"; |
| 112 | /* ����첽��������������Ϊ�˳�״̬ */ |
| 113 | client_->get_handle().stop(); |
| 114 | } |
| 115 | std::cout << std::endl; |
| 116 | delete this; |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | /* ����첽�������ܼ�ص��첽������ */ |
| 121 | int nleft = client_->get_handle().length(); |
| 122 | if (ctx_->nopen_total == ctx_->nopen_limit && nleft == 1) { |
| 123 | std::cout << "Id: " << id_ << " stop now! nstream: " |
| 124 | << nleft << std::endl; |
| 125 | /* ����첽��������������Ϊ�˳�״̬ */ |
| 126 | client_->get_handle().stop(); |
| 127 | } |
| 128 | |
| 129 | // �����ڴ˴�ɾ���ö�̬����Ļص�������Է�ֹ�ڴ�й¶ |
| 130 | delete this; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * �����麯�������첽����ʱʱ���ô˺��� |
nothing calls this directly
no test coverage detected