diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -3,21 +3,18 @@ package main import ( "bufio" "net" - "os" + "flag" + "errors" + "io" "go.lindenii.runxiyu.org/lindenii-common/clog" - "go.lindenii.runxiyu.org/lindenii-common/scfg" ) const VERSION = "lindenii-maild v0.0.0" func main() { - config_file, err := os.Open("maild.scfg") - if err != nil { - panic(err) - } - - err = scfg.NewDecoder(bufio.NewReader(config_file)).Decode(&config) + config_path := flag.String("config", "maild.scfg", "path to configuration file") + err := load_config(*config_path) if err != nil { panic(err) } @@ -36,7 +33,7 @@ func main() { go func() { err := handle_incoming_server_connection(bufio.NewReader(conn), bufio.NewWriter(conn)) - if err != nil { + if err != nil && !errors.Is(err, io.EOF) { clog.Error("connection handler returned error", "err", err) } }() |