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

Method service_on_accept

lib_acl_cpp/src/master/master_threads.cpp:216–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216int master_threads::service_on_accept(void* ctx, ACL_VSTREAM* client)
217{
218 master_threads* mt = (master_threads *) ctx;
219 acl_assert(mt);
220
221 // client->context ��Ӧ��ռ��
222 if (client->context != NULL) {
223 logger_fatal("client->context not null!");
224 }
225
226 socket_stream* stream = NEW socket_stream();
227
228 // ���� client->context Ϊ�����󣬸�������ͳһ��
229 // service_on_close �б��ͷ�
230 client->context = stream;
231
232 if (!stream->open(client)) {
233 logger_error("open stream error(%s)", acl_last_serror());
234 // ���� -1 ���ϲ��ܵ��� service_on_close ���̣�������
235 // �ͷ� stream ����
236 return -1;
237 }
238
239 // �������� thread_on_accept �������� false����ֱ�ӷ��ظ��ϲ�
240 // ��� -1�����ϲ����ٵ��� service_on_close ���̣��Ӷ��ڸù���
241 // �н� stream �����ͷ�
242 if (!mt->thread_on_accept(stream)) {
243 return -1;
244 }
245
246 // �������� thread_on_handshake �������� false����ֱ�ӷ��ظ��ϲ�
247 // ��� -1�����ϲ����ٵ��� service_on_close ���̣��Ӷ��ڸù���
248 // �н� stream �����ͷ�
249 //if (mt->thread_on_handshake(stream) == false)
250 // return -1;
251
252 // ���� 0 ��ʾ���Լ��������ÿͻ������ӣ��Ӷ����ϲ��ܽ�������
253 // ����ؼ�����
254 return 0;
255}
256
257int master_threads::service_on_handshake(void* ctx, ACL_VSTREAM *client)
258{

Callers

nothing calls this directly

Calls 4

acl_last_serrorFunction · 0.85
socket_streamClass · 0.50
openMethod · 0.45
thread_on_acceptMethod · 0.45

Tested by

no test coverage detected