| 597 | } |
| 598 | |
| 599 | redis_slot* redis_cluster::get_slot(const redis_result* rr, |
| 600 | size_t slot_max, size_t slot_min) |
| 601 | { |
| 602 | if (rr == NULL) { |
| 603 | return NULL; |
| 604 | } |
| 605 | |
| 606 | size_t size; |
| 607 | const redis_result** children = rr->get_children(&size); |
| 608 | if (children == NULL || size < 2) { |
| 609 | return NULL; |
| 610 | } |
| 611 | |
| 612 | char ip[128]; |
| 613 | if (children[0]->argv_to_string(ip, sizeof(ip)) <= 0) { |
| 614 | return NULL; |
| 615 | } |
| 616 | |
| 617 | int port = children[1]->get_integer(); |
| 618 | if (port <= 0) { |
| 619 | return NULL; |
| 620 | } |
| 621 | |
| 622 | redis_slot* slot = NEW redis_slot(slot_min, slot_max, ip, port); |
| 623 | return slot; |
| 624 | } |
| 625 | |
| 626 | void redis_cluster::free_slots() |
| 627 | { |
no test coverage detected