diff options
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) } |