diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -2,9 +2,7 @@ package main import ( "context" - "errors" "flag" - "io" "net" "go.lindenii.runxiyu.org/lindenii-common/clog" @@ -31,7 +29,7 @@ func main() { for { conn, err := listener.Accept() if err != nil { - clog.Error("MX: Cannot accept connection: "+err.Error()) + clog.Error("MX: Cannot accept connection: " + err.Error()) } clog.Info("MX: Accepted connection from " + conn.RemoteAddr().String()) @@ -39,10 +37,14 @@ func main() { 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("MX: Connection handler for " + conn.RemoteAddr().String() + " returned error: " + err.Error()) + if err != nil { + if err == err_connection_handler_eof { + clog.Info("MX: Connection for " + conn.RemoteAddr().String() + " closed with EOF") + } else { + clog.Error("MX: Connection handler for " + conn.RemoteAddr().String() + " returned error: " + err.Error()) + } } else { - clog.Error("MX: Connection handler for " + conn.RemoteAddr().String() + " returned error: " + err.Error()) + clog.Info("MX: Connection for " + conn.RemoteAddr().String() + " closed gracefully") } }() } |