aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-02 19:30:51 +0000
committerRunxi Yu <me@runxiyu.org>2025-01-02 19:30:51 +0000
commit00f3cb9fb48cfb9768b695bd0d9eb8367ad84782 (patch)
tree2e35b4252b2538c7dbe13d90b501216ded240149 /main.go
parentFile splitting (diff)
downloadmaild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.tar.gz
maild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.tar.zst
maild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.zip
Deliver to inbox
Diffstat (limited to '')
-rw-r--r--main.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/main.go b/main.go
index 8d6b797..052deec 100644
--- a/main.go
+++ b/main.go
@@ -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)
}
}()