mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-04 13:37:41 +03:00
To support unusual configuration syntax, endpoint modules (imap, smtp,
etc) relied on rather awkward code using modName+instName+aliases as
arguments. This commit replaces old handling with use of special
signature similar to inlineArgs introduced in 1edd031
.
Endpoint modules are placed in a separate 'registry' and use
different initialization callback signature for simplicity. This makes
them inaccessible for other modules, though they are not supposed to be
anyway.
Endpoint modules are initialized before other modules. This allows
detecting unused configuration blocks by checking for modules
that were not lazily initalized after endpoint initialization.
This relies on endpoint modules being essentially "roots" of
instances dependency tree.
Idea of "semantical module names" is completely dropped now and so
HACKING.md is updated to not mention it.
26 lines
473 B
Go
26 lines
473 B
Go
//+build windows
|
|
|
|
package maddy
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/foxcpp/maddy/log"
|
|
)
|
|
|
|
func handleSignals() os.Signal {
|
|
sig := make(chan os.Signal, 5)
|
|
signal.Notify(sig, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGINT)
|
|
|
|
s := <-sig
|
|
go func() {
|
|
s := waitForSignal()
|
|
log.Printf("forced shutdown due to signal (%v)!", s)
|
|
os.Exit(1)
|
|
}()
|
|
|
|
log.Printf("signal received (%v), next signal will force immediate shutdown.", s)
|
|
return s
|
|
}
|