| 177 | } |
| 178 | |
| 179 | void TorControlConnection::eventcb(struct bufferevent *bev, short what, void *ctx) |
| 180 | { |
| 181 | TorControlConnection *self = static_cast<TorControlConnection*>(ctx); |
| 182 | if (what & BEV_EVENT_CONNECTED) { |
| 183 | LogPrint(BCLog::TOR, "tor: Successfully connected!\n"); |
| 184 | self->connected(*self); |
| 185 | } else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) { |
| 186 | if (what & BEV_EVENT_ERROR) { |
| 187 | LogPrint(BCLog::TOR, "tor: Error connecting to Tor control socket\n"); |
| 188 | } else { |
| 189 | LogPrint(BCLog::TOR, "tor: End of stream\n"); |
| 190 | } |
| 191 | self->Disconnect(); |
| 192 | self->disconnected(*self); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | bool TorControlConnection::Connect(const std::string &target, const ConnectionCB& _connected, const ConnectionCB& _disconnected) |
| 197 | { |
nothing calls this directly
no test coverage detected