* �����麯��, �����첽���ر�ʱ���ô˻ص����� */
| 125 | * �����麯��, �����첽���ر�ʱ���ô˻ص����� |
| 126 | */ |
| 127 | void close_callback(void) |
| 128 | { |
| 129 | if (!client_->is_opened()) { |
| 130 | std::cout << "Id: " << id_ << " connect " |
| 131 | << ctx_->addr << " error: " |
| 132 | << acl::last_serror(); |
| 133 | |
| 134 | // ����ǵ�һ�����Ӿ�ʧ�ܣ����˳� |
| 135 | if (ctx_->nopen_total == 0) { |
| 136 | std::cout << ", first connect error, quit"; |
| 137 | /* ����첽��������������Ϊ�˳�״̬ */ |
| 138 | client_->get_handle().stop(); |
| 139 | } |
| 140 | std::cout << std::endl; |
| 141 | delete this; |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | /* ����첽�������ܼ�ص��첽������ */ |
| 146 | int nleft = client_->get_handle().length(); |
| 147 | if (ctx_->nopen_total == ctx_->nopen_limit && nleft == 1) { |
| 148 | std::cout << "Id: " << id_ << " stop now! nstream: " |
| 149 | << nleft << std::endl; |
| 150 | /* ����첽��������������Ϊ�˳�״̬ */ |
| 151 | client_->get_handle().stop(); |
| 152 | } |
| 153 | |
| 154 | // �����ڴ˴�ɾ���ö�̬����Ļص�������Է�ֹ�ڴ�й¶ |
| 155 | delete this; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * �����麯�������첽����ʱʱ���ô˺��� |
nothing calls this directly
no test coverage detected