mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-11-10 14:44:04 +08:00
Merge remote-tracking branch 'origin/main' into cluster-cancel-relay
# Conflicts: # docs/releases.md
This commit is contained in:
commit
49a28e8cdb
17 files changed
+262
-66
No files matched your search
+9
-8
@@ -53,7 +53,7 @@ type Server struct {
|
||||
config *Config
|
||||
db *db.DB // Shared PostgreSQL connection pool (with optional replicas), nil when using SQLite
|
||||
cluster cluster.Cluster // Fans messages out to peer cluster nodes (nop when not clustered)
|
||||
httpServer *http.Server
|
||||
httpServers []*http.Server
|
||||
httpsServer *http.Server
|
||||
httpMetricsServer *http.Server
|
||||
httpProfileServer *http.Server
|
||||
@@ -408,8 +408,8 @@ func createAttachmentStore(conf *Config, messageCache *message.Cache) (*attachme
|
||||
// a manager go routine to print stats and prune messages.
|
||||
func (s *Server) Run() error {
|
||||
var listenStr string
|
||||
if s.config.ListenHTTP != "" {
|
||||
listenStr += fmt.Sprintf(" %s[http]", s.config.ListenHTTP)
|
||||
for _, addr := range s.config.ListenHTTP {
|
||||
listenStr += fmt.Sprintf(" %s[http]", addr)
|
||||
}
|
||||
if s.config.ListenHTTPS != "" {
|
||||
listenStr += fmt.Sprintf(" %s[https]", s.config.ListenHTTPS)
|
||||
@@ -443,10 +443,11 @@ func (s *Server) Run() error {
|
||||
return nil // Stopped while we waited for the lock, i.e. the stores are closed by now
|
||||
}
|
||||
s.closeChan = make(chan bool)
|
||||
if s.config.ListenHTTP != "" {
|
||||
s.httpServer = &http.Server{Addr: s.config.ListenHTTP, Handler: mux}
|
||||
for _, addr := range s.config.ListenHTTP {
|
||||
httpServer := &http.Server{Addr: addr, Handler: mux}
|
||||
s.httpServers = append(s.httpServers, httpServer)
|
||||
go func() {
|
||||
errChan <- s.httpServer.ListenAndServe()
|
||||
errChan <- httpServer.ListenAndServe()
|
||||
}()
|
||||
}
|
||||
if s.config.ListenHTTPS != "" {
|
||||
@@ -550,8 +551,8 @@ func (s *Server) stopBounded() {
|
||||
func (s *Server) stop() {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if s.httpServer != nil {
|
||||
s.httpServer.Close()
|
||||
for _, httpServer := range s.httpServers {
|
||||
httpServer.Close()
|
||||
}
|
||||
if s.httpsServer != nil {
|
||||
s.httpsServer.Close()
|
||||
|
||||
Reference in new issue
Block a user