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

Method run

lib_acl_cpp/src/redis/redis_client_cluster.cpp:477–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477const redis_result* redis_client_cluster::run(redis_command& cmd,
478 size_t nchild, int* timeout /* = NULL */)
479{
480 redis_client* conn = peek_conn(cmd.get_slot());
481
482 // ���û���ҵ����õ����Ӷ�����ֱ�ӷ��� NULL ��ʾ����
483 if (conn == NULL) {
484 logger_error("peek_conn NULL, slot_: %d", cmd.get_slot());
485 return NULL;
486 }
487
488 cmd.set_client_addr(*conn);
489 conn->set_check_addr(cmd.is_check_addr());
490
491 redis_result_t type;
492 bool last_moved = false;
493 int n = 0;
494
495 dbuf_pool* dbuf = cmd.get_dbuf();
496 redis_request* obj = cmd.get_request_obj();
497 string* buf = cmd.get_request_buf();
498
499 const redis_result* result;
500
501 while (n++ < redirect_max_) {
502 // ������������Ƿ�����ڴ��Ƭ��ʽ���ò�ͬ���������
503 if (cmd.is_slice_req()) {
504 result = conn->run(dbuf, *obj, nchild, timeout);
505 } else {
506 result = conn->run(dbuf, *buf, nchild, timeout);
507 }
508
509 // ��������쳣�Ͽ�������Ҫ��������
510 if (conn->eof()) {
511 conn = reopen(cmd, conn);
512 if (conn == NULL) {
513 return result;
514 }
515 last_moved = true;
516 continue;
517 }
518
519 if (result == NULL) {
520 // �������Ӷ���黹�����ӳض���
521 conn->get_pool()->put(conn, true);
522 logger_error("result NULL");
523 return NULL;
524 }
525
526 // ȡ�÷���������Ӧ��������ͣ������зֱ���
527 type = result->get_type();
528
529 if (type == REDIS_RESULT_UNKOWN) {
530 // �������Ӷ���黹�����ӳض���
531 conn->get_pool()->put(conn, true);
532 logger_error("unknown result type: %d", type);
533 return NULL;
534 }

Callers 1

askMethod · 0.45

Calls 10

get_slotMethod · 0.80
set_client_addrMethod · 0.80
get_dbufMethod · 0.80
set_check_addrMethod · 0.45
eofMethod · 0.45
putMethod · 0.45
get_typeMethod · 0.45
get_addrMethod · 0.45
get_errorMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected