From 42c5f39700c6ba95a6b924be807e8cddd69c3bdd Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 13 Jan 2025 12:02:49 +0800 Subject: Add PostgreSQL mail store support --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main.go') 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) } -- cgit v1.2.3