aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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)
}