| 653 | } |
| 654 | |
| 655 | void redis_client_pipeline::cluster_down(const redis_pipeline_message &msg) |
| 656 | { |
| 657 | const std::string& addr = msg.get_addr(); |
| 658 | |
| 659 | // Clear all slots' addrs same as the dead node |
| 660 | for (size_t i = 0; i < max_slot_; i++) { |
| 661 | if (slot_addrs_[i] && addr == slot_addrs_[i]) { |
| 662 | slot_addrs_[i] = NULL; |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | // Reset the default addr which different from the dead node |
| 667 | if (addr_ == addr) { |
| 668 | for (std::vector<char*>::const_iterator it = addrs_.begin(); |
| 669 | it != addrs_.end(); ++it) { |
| 670 | if (addr != *it) { |
| 671 | addr_ = *it; |
| 672 | break; |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | // Stop and remove the dead node |
| 677 | logger("Stop one channel thread, addr=%s", addr.c_str()); |
| 678 | stop_channel(addr.c_str()); |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | void redis_client_pipeline::channel_closed(redis_pipeline_channel* channel) |
| 683 | { |