X-Git-Url: http://www.git.cypherpunks.ru/?p=goircd.git;a=blobdiff_plain;f=goircd.go;h=984b47b94144c134e7bfc57158b52de13dddbf84;hp=dbf6d7dd84384e182a9ee00f3290d4d107033db0;hb=a939b027fdb6ce1d0822e76ec50814678ff0050a;hpb=5c79c4235ec745fa47c1f176657287dab4f61ed5 diff --git a/goircd.go b/goircd.go index dbf6d7d..984b47b 100644 --- a/goircd.go +++ b/goircd.go @@ -23,17 +23,21 @@ import ( "io/ioutil" "log" "net" + "os" + "os/signal" "path" "path/filepath" "strings" + "syscall" ) var ( - hostname = flag.String("hostname", "localhost", "Hostname") - bind = flag.String("bind", ":6667", "Address to bind to") - motd = flag.String("motd", "", "Path to MOTD file") - logdir = flag.String("logdir", "", "Absolute path to directory for logs") - statedir = flag.String("statedir", "", "Absolute path to directory for states") + hostname = flag.String("hostname", "localhost", "Hostname") + bind = flag.String("bind", ":6667", "Address to bind to") + motd = flag.String("motd", "", "Path to MOTD file") + logdir = flag.String("logdir", "", "Absolute path to directory for logs") + statedir = flag.String("statedir", "", "Absolute path to directory for states") + passwords = flag.String("passwords", "", "Optional path to passwords file") tlsKey = flag.String("tls_key", "", "TLS keyfile") tlsCert = flag.String("tls_cert", "", "TLS certificate") @@ -118,6 +122,18 @@ func Run() { } log.Println("Listening on", *bind) + if *passwords != "" { + daemon.PasswordsRefresh() + hups := make(chan os.Signal) + signal.Notify(hups, syscall.SIGHUP) + go func() { + for { + <-hups + daemon.PasswordsRefresh() + } + }() + } + go daemon.Processor(events) for { conn, err := listener.Accept()