1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-29 01:45:35 +02:00

Fix Poll(); yeyy tests

This commit is contained in:
Philipp Heckel 2021-12-22 23:45:19 +01:00
parent fe5734d9f0
commit 85939618c8
6 changed files with 63 additions and 4 deletions
server

View file

@ -196,16 +196,17 @@ func (s *Server) Run() error {
listenStr += fmt.Sprintf(" %s/https", s.config.ListenHTTPS)
}
log.Printf("Listening on %s", listenStr)
http.HandleFunc("/", s.handle)
mux := http.NewServeMux()
mux.HandleFunc("/", s.handle)
errChan := make(chan error)
s.mu.Lock()
s.closeChan = make(chan bool)
s.httpServer = &http.Server{Addr: s.config.ListenHTTP}
s.httpServer = &http.Server{Addr: s.config.ListenHTTP, Handler: mux}
go func() {
errChan <- s.httpServer.ListenAndServe()
}()
if s.config.ListenHTTPS != "" {
s.httpsServer = &http.Server{Addr: s.config.ListenHTTP}
s.httpsServer = &http.Server{Addr: s.config.ListenHTTP, Handler: mux}
go func() {
errChan <- s.httpsServer.ListenAndServeTLS(s.config.CertFile, s.config.KeyFile)
}()