| 315 | } |
| 316 | |
| 317 | bool StartRPCServer() { |
| 318 | LogPrint(BCLog::INFO, "Starting HTTP RPC server\n"); |
| 319 | if (!InitRPCAuthentication()) { |
| 320 | return false; |
| 321 | } |
| 322 | if (!InitHTTPServer()) { |
| 323 | StopRPCServer(); |
| 324 | return false; |
| 325 | } |
| 326 | |
| 327 | RegisterHTTPHandler("/", true, JsonRPCHandler); |
| 328 | |
| 329 | struct event_base* eventBase = EventBase(); |
| 330 | assert(eventBase); |
| 331 | httpRPCTimerInterface = MakeUnique<HTTPRPCTimerInterface>(eventBase); |
| 332 | RPCSetTimerInterface(httpRPCTimerInterface.get()); |
| 333 | StartHTTPServer(); |
| 334 | |
| 335 | return true; |
| 336 | } |
| 337 | |
| 338 | void InterruptRPCServer() { |
| 339 | LogPrint(BCLog::INFO, "Interrupting HTTP RPC server\n"); |
no test coverage detected