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

Method service_main

lib_acl_cpp/src/master/master_threads.cpp:277–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277int 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
318void master_threads::service_on_listen(void* ctx, ACL_VSTREAM* sstream)
319{

Callers

nothing calls this directly

Calls 4

thread_on_readMethod · 0.45
keep_readMethod · 0.45
eofMethod · 0.45
sock_handleMethod · 0.45

Tested by

no test coverage detected