| 114 | } |
| 115 | |
| 116 | int MasterIORouter::GetDestEndpoint(std::string & dest_ip, int & dest_port) { |
| 117 | int ret = 0; |
| 118 | dest_ip = ""; |
| 119 | std::string master_ip = ""; |
| 120 | |
| 121 | ret = group_status_cache_->GetMaster(master_ip); |
| 122 | if (ret != 0) { |
| 123 | LOG_ERR("getmaster failed, ret %d", ret); |
| 124 | return -__LINE__; |
| 125 | } |
| 126 | |
| 127 | bool is_master = (master_ip == worker_config_->listen_ip_); |
| 128 | if (is_master) { |
| 129 | dest_ip = "127.0.0.1"; |
| 130 | dest_port = config_->GetMysqlPort(); |
| 131 | } else { |
| 132 | dest_ip = master_ip; |
| 133 | dest_port = config_->ProxyProtocol() ? worker_config_->proxy_port_ : worker_config_->port_; |
| 134 | } |
| 135 | |
| 136 | LOG_DEBUG("dest ip [%s] port [%d]", dest_ip.c_str(), dest_port); |
| 137 | return 0; |
| 138 | } |
| 139 | |
| 140 | SlaveIORouter::SlaveIORouter(PHXSqlProxyConfig * config, |
| 141 | WorkerConfig_t * worker_config, |
nothing calls this directly
no test coverage detected