MCPcopy Create free account
hub / github.com/acl-dev/acl / close_callback

Method close_callback

lib_acl_cpp/samples/aio/aio_client/main.cpp:127–156  ·  view source on GitHub ↗

* �����麯��, �����첽���ر�ʱ���ô˻ص����� */

Source from the content-addressed store, hash-verified

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 * �����麯�������첽����ʱʱ���ô˺���

Callers

nothing calls this directly

Calls 5

last_serrorFunction · 0.50
is_openedMethod · 0.45
stopMethod · 0.45
get_handleMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected