| 214 | } |
| 215 | |
| 216 | int 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 | |
| 257 | int master_threads::service_on_handshake(void* ctx, ACL_VSTREAM *client) |
| 258 | { |
nothing calls this directly
no test coverage detected