| 275 | } |
| 276 | |
| 277 | int master_threads::service_main(void* ctx, ACL_VSTREAM *client) |
| 278 | { |
| 279 | master_threads* mt = (master_threads *) ctx; |
| 280 | acl_assert(mt != NULL); |
| 281 | |
| 282 | // client->context �� service_on_accept ����� |
| 283 | socket_stream* stream = (socket_stream*) client->context; |
| 284 | if (stream == NULL) { |
| 285 | logger_fatal("client->context is null!"); |
| 286 | } |
| 287 | |
| 288 | // ����������麯��ʵ�֣�������� true ��ʾ�ÿ�ܼ�����ظ��������� |
| 289 | // ������Ҫ�رո��� |
| 290 | // ���ϲ��ܷ���ֵ�������£� |
| 291 | // 0 ��ʾ��������ӱ��ֳ����ӣ�����Ҫ������ظ������Ƿ�ɶ� |
| 292 | // -1 ��ʾ��Ҫ�رո����� |
| 293 | // 1 ��ʾ���ټ�ظ����� |
| 294 | |
| 295 | if (mt->thread_on_read(stream)) { |
| 296 | // ��������ڷ��� true ��ϣ����ܼ������������ֱ�ӷ��ظ���� 1 |
| 297 | if (!mt->keep_read(stream)) { |
| 298 | return 1; |
| 299 | } |
| 300 | |
| 301 | // ������Ҫ�������Ƿ��Ѿ��رգ�����رգ�����뷵�� -1 |
| 302 | if (stream->eof()) { |
| 303 | logger_error("DISCONNECTED, CLOSING, FD: %d", |
| 304 | (int) stream->sock_handle()); |
| 305 | return -1; |
| 306 | } |
| 307 | |
| 308 | // ���� 0 ��ʾ������ظ����Ŀɶ�״̬ |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | // ���� -1 ��ʾ���ϲ��������ر������ϲ����������ر���ǰ |
| 313 | // ����ص� service_on_close ���̽������ر�ǰ���ƺ��������� |
| 314 | // stream ������ service_on_close �б��ͷ� |
| 315 | return -1; |
| 316 | } |
| 317 | |
| 318 | void master_threads::service_on_listen(void* ctx, ACL_VSTREAM* sstream) |
| 319 | { |
nothing calls this directly
no test coverage detected