| 149 | } |
| 150 | |
| 151 | SocketMap::~SocketMap() { |
| 152 | RPC_VLOG << "Destroying SocketMap=" << this; |
| 153 | if (_has_close_idle_thread) { |
| 154 | bthread_stop(_close_idle_thread); |
| 155 | bthread_join(_close_idle_thread, NULL); |
| 156 | } |
| 157 | if (!_map.empty()) { |
| 158 | std::ostringstream err; |
| 159 | int nleft = 0; |
| 160 | for (Map::iterator it = _map.begin(); it != _map.end(); ++it) { |
| 161 | SingleConnection* sc = &it->second; |
| 162 | if ((!sc->socket->Failed() || |
| 163 | sc->socket->HCEnabled()) && |
| 164 | sc->ref_count != 0) { |
| 165 | ++nleft; |
| 166 | if (nleft == 0) { |
| 167 | err << "Left in SocketMap(" << this << "):"; |
| 168 | } |
| 169 | err << ' ' << *sc->socket; |
| 170 | } |
| 171 | } |
| 172 | if (nleft) { |
| 173 | LOG(ERROR) << err.str(); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | delete _this_map_bvar; |
| 178 | _this_map_bvar = NULL; |
| 179 | |
| 180 | delete _options.socket_creator; |
| 181 | _options.socket_creator = NULL; |
| 182 | } |
| 183 | |
| 184 | int SocketMap::Init(const SocketMapOptions& options) { |
| 185 | if (_options.socket_creator != NULL) { |
nothing calls this directly
no test coverage detected