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

Method accept_callback

lib_acl_cpp/samples/ssl/aio_server/main.cpp:178–225  ·  view source on GitHub ↗

* �����麯�������������ӵ������ô˻ص����� * @param client {aio_socket_stream*} �첽�ͻ����� * @return {bool} ���� true ��֪ͨ�������������� */

Source from the content-addressed store, hash-verified

176 * @return {bool} ���� true ��֪ͨ��������������
177 */
178 bool accept_callback(acl::aio_socket_stream* client)
179 {
180 //acl_non_blocking(client->sock_handle(), ACL_BLOCKING);
181
182 // �����첽�ͻ������Ļص���������첽�����а�
183 io_callback* callback = new io_callback(client);
184
185 // ע���첽���Ķ��ص�����
186 client->add_read_callback(callback);
187
188 // ע���첽����д�ص�����
189 client->add_write_callback(callback);
190
191 // ע���첽���Ĺرջص�����
192 client->add_close_callback(callback);
193
194 // ע���첽���ij�ʱ�ص�����
195 client->add_timeout_callback(callback);
196
197 // ���޶�����������󳤶�ʱ
198 if (__max > 0)
199 client->set_buf_max(__max);
200
201 // SSL ģʽ�£��ȴ��ͻ��˷���������Ϣ
202 if (__ssl_conf != NULL) {
203 acl::sslbase_io* ssl = __ssl_conf->create(true);
204
205 // ע�� SSL IO ���̵Ĺ���
206 if (client->setup_hook(ssl) == ssl) {
207 std::cout << "setup_hook error" << std::endl;
208 ssl->destroy();
209 return false;
210 }
211
212 // ���ͻ������ڶ�����״̬�Դ��� read_wakeup �ص����̣�
213 // SSL ���ֹ��̽��� read_wakeup �����
214 printf(">>>begin wait for ssl handshake\r\n");
215 client->read_wait(__timeout);
216 }
217
218 // �� SSL ģʽ�£����첽����һ������
219 else {
220 //client->read(__timeout);
221 client->gets(__timeout, false);
222 }
223
224 return true;
225 }
226};
227
228static void usage(const char* procname)

Callers

nothing calls this directly

Calls 9

add_read_callbackMethod · 0.80
add_write_callbackMethod · 0.80
add_close_callbackMethod · 0.80
add_timeout_callbackMethod · 0.80
read_waitMethod · 0.80
getsMethod · 0.80
createMethod · 0.45
setup_hookMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected