| 63 | } |
| 64 | |
| 65 | int remove_peer() { |
| 66 | CHECK_FLAG(conf); |
| 67 | CHECK_FLAG(peer); |
| 68 | CHECK_FLAG(group); |
| 69 | Configuration conf; |
| 70 | if (conf.parse_from(FLAGS_conf) != 0) { |
| 71 | LOG(ERROR) << "Fail to parse --conf=`" << FLAGS_conf << '\''; |
| 72 | return -1; |
| 73 | } |
| 74 | PeerId removing_peer; |
| 75 | if (removing_peer.parse(FLAGS_peer) != 0) { |
| 76 | LOG(ERROR) << "Fail to parse --peer=`" << FLAGS_peer<< '\''; |
| 77 | return -1; |
| 78 | } |
| 79 | CliOptions opt; |
| 80 | opt.timeout_ms = FLAGS_timeout_ms; |
| 81 | opt.max_retry = FLAGS_max_retry; |
| 82 | butil::Status st = remove_peer(FLAGS_group, conf, removing_peer, opt); |
| 83 | if (!st.ok()) { |
| 84 | LOG(ERROR) << "Fail to remove_peer : " << st; |
| 85 | return -1; |
| 86 | } |
| 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | int change_peers() { |
| 91 | CHECK_FLAG(new_peers); |