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

Method open_callback

lib_acl_cpp/samples/aio/aio_connect/main.cpp:134–158  ·  view source on GitHub ↗

* �����麯��, ���첽���ӳɹ�����ô˺��� * @return {bool} ���ظ������� true ��ʾ�����������ʾ��Ҫ�ر��첽�� */

Source from the content-addressed store, hash-verified

132 * @return {bool} ���ظ������� true ��ʾ�����������ʾ��Ҫ�ر��첽��
133 */
134 bool open_callback(void)
135 {
136 // ���ӳɹ�������IO��д�ص�����
137 client_->add_read_callback(this);
138 client_->add_write_callback(this);
139 ctx_->nopen_total++;
140
141 std::cout << "opend ok, nopen: " << ctx_->nopen_total
142 << std::endl;
143
144 acl::assert_(id_ > 0);
145 if (ctx_->nopen_total < ctx_->nopen_limit) {
146 // ��ʼ������һ�����ӹ���
147 if (!connect_server(ctx_, id_ + 1)) {
148 std::cout << "connect error!"
149 << acl::last_serror() << std::endl;
150 }
151 }
152
153 // �첽�ӷ�������ȡһ������
154 client_->gets(ctx_->read_timeout, false);
155
156 // ��ʾ�����첽����
157 return true;
158 }
159
160private:
161 acl::aio_socket_stream* client_;

Callers

nothing calls this directly

Calls 6

assert_Function · 0.85
add_read_callbackMethod · 0.80
add_write_callbackMethod · 0.80
getsMethod · 0.80
connect_serverFunction · 0.70
last_serrorFunction · 0.50

Tested by

no test coverage detected