aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-13 12:02:49 +0800
committerRunxi Yu <me@runxiyu.org>2025-01-13 12:02:49 +0800
commit42c5f39700c6ba95a6b924be807e8cddd69c3bdd (patch)
treea61dc937793b00684a03a14b2ec4adfca5f632da /main.go
parentAdd addresses (diff)
downloadmaild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.gz
maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.zst
maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.zip
Add PostgreSQL mail store support
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.go b/main.go
index 274e9b7..f1c28ba 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "context"
"errors"
"flag"
"io"
@@ -20,7 +21,7 @@ func main() {
panic(err)
}
- listener, err := net.Listen("tcp", ":25")
+ listener, err := net.Listen(config.MX.Net, config.MX.Addr)
if err != nil {
panic(err)
}
@@ -33,7 +34,9 @@ func main() {
}
go func() {
- err := handle_mx_recv_conn(conn)
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ err := handle_mx_recv_conn(ctx, conn)
if err != nil && !errors.Is(err, io.EOF) {
clog.Error("connection handler returned error", "err", err)
}