| 183 | } |
| 184 | |
| 185 | void connect_manager::set(const char* addr, size_t max, int conn_timeout /* 30 */, |
| 186 | int rw_timeout /* 30 */, bool sockopt_timeo /* false */, size_t min /* 0 */) |
| 187 | { |
| 188 | string buf(addr); |
| 189 | buf.lower(); |
| 190 | |
| 191 | lock_guard guard(lock_); |
| 192 | std::map<string, conn_config>::iterator it = addrs_.find(buf); |
| 193 | if (it == addrs_.end()) { |
| 194 | conn_config config; |
| 195 | config.addr = addr; |
| 196 | config.max = max; |
| 197 | config.min = min; |
| 198 | config.conn_timeout = conn_timeout; |
| 199 | config.rw_timeout = rw_timeout; |
| 200 | config.sockopt_timeo = sockopt_timeo; |
| 201 | addrs_[buf] = config; |
| 202 | } else { |
| 203 | it->second.max = max; |
| 204 | it->second.min = min; |
| 205 | it->second.conn_timeout = conn_timeout; |
| 206 | it->second.rw_timeout = rw_timeout; |
| 207 | it->second.sockopt_timeo = sockopt_timeo; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | const conn_config* connect_manager::get_config(const char* addr, |
| 212 | bool use_first /* false */) |
no test coverage detected