Start initializes the Canopy RPC servers
()
| 78 | |
| 79 | // Start initializes the Canopy RPC servers |
| 80 | func (s *Server) Start() { |
| 81 | // Start the Query and Admin RPC servers concurrently |
| 82 | go s.startRPC(createRouter(s), s.config.RPCPort) |
| 83 | go s.startRPC(createAdminRouter(s), s.config.AdminPort) |
| 84 | |
| 85 | // Start tasks to update poll results and poll root chain information |
| 86 | go s.updatePollResults() |
| 87 | go s.rcManager.Start() |
| 88 | go s.startEthRPCService() |
| 89 | |
| 90 | // Start heap profiler if enabled (warning: causes GC pauses which may affect RPC latency) |
| 91 | if s.config.HeapProfilingEnabled { |
| 92 | go s.startHeapProfiler() |
| 93 | } |
| 94 | |
| 95 | if s.config.Headless { |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | // Start in-process HTTP servers for the wallet and explorer |
| 100 | s.startStaticFileServers() |
| 101 | } |
| 102 | |
| 103 | // startRPC starts an RPC server with the provided router and port |
| 104 | func (s *Server) startRPC(router *httprouter.Router, port string) { |
no test coverage detected