diff options
author | Runxi Yu <me@runxiyu.org> | 2025-01-13 12:02:49 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-01-13 12:02:49 +0800 |
commit | 42c5f39700c6ba95a6b924be807e8cddd69c3bdd (patch) | |
tree | a61dc937793b00684a03a14b2ec4adfca5f632da /main.go | |
parent | Add addresses (diff) | |
download | maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.gz maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.zst maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.zip |
Add PostgreSQL mail store support
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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) } |