public void Start() { Stop(); startTime = DateTime.Now; X509Certificate2 cert = null; if (!string.IsNullOrWhiteSpace(cfg.certificate_pfx_path) && File.Exists(cfg.certificate_pfx_path)) { if (!string.IsNullOrEmpty(cfg.certificate_pfx_password)) { cert = new X509Certificate2(cfg.certificate_pfx_path, cfg.certificate_pfx_password); } else { cert = new X509Certificate2(cfg.certificate_pfx_path); } } httpServer = new MJpegServer(cfg.webport, cfg.webport_https, cert); httpServer.SocketBound += Server_SocketBound; httpServer.CertificateExpirationWarning += HttpServer_CertificateExpirationWarning; httpServer.Start(); webSocketServer = new CameraProxyWebSocketServer(cfg.webSocketPort, cfg.webSocketPort_secure, cert); webSocketServer.SocketBound += Server_SocketBound; webSocketServer.Start(); thrCertificateMaintainer = new Thread(maintainLetsEncryptCertificate); thrCertificateMaintainer.Name = "Maintain LetsEncrypt Certificate"; thrCertificateMaintainer.IsBackground = true; thrCertificateMaintainer.Start(); }
public void Stop() { if (httpServer != null) { httpServer.Stop(); httpServer.Join(1000); } // webSocketServer does not support closing/stopping webSocketServer = null; }
public void Start() { Stop(); startTime = DateTime.Now; httpServer = new MJpegServer(cfg.webport, cfg.webport_https); httpServer.Start(); webSocketServer = new CameraProxyWebSocketServer(cfg.webSocketPort, cfg.webSocketPort_secure); webSocketServer.Start(); }
public void Stop() { Try.Catch(() => { thrCertificateMaintainer?.Abort(); }); if (httpServer != null) { httpServer.Stop(); httpServer.Join(1000); } // webSocketServer does not support closing/stopping webSocketServer = null; }