monitoring starts an HTTP server for monitoring purposes.
()
| 115 | |
| 116 | // monitoring starts an HTTP server for monitoring purposes. |
| 117 | func (e *ECU) monitoring() { |
| 118 | ln, err := net.Listen("tcp", e.cfg.MonitorAddress) |
| 119 | if err != nil { |
| 120 | log.Fatal("listen error:", err) |
| 121 | } |
| 122 | |
| 123 | monitorHTTP := &http.Server{ |
| 124 | ReadTimeout: 30 * time.Second, |
| 125 | WriteTimeout: 30 * time.Second, |
| 126 | MaxHeaderBytes: 1 << 20, |
| 127 | } |
| 128 | go monitorHTTP.Serve(ln) |
| 129 | |
| 130 | <-e.shutdownMonitor |
| 131 | ln.Close() |
| 132 | e.shutdownMonitor <- true |
| 133 | } |
| 134 | |
| 135 | // controlTLSConfig returns a TLS configuration for use by the control server. |
| 136 | func (e *ECU) controlTLSConfig() (*tls.Config, error) { |