From 23974469f387b20dc77bb2f66f8100922c85d93c Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 16 Jan 2025 16:35:34 +0800 Subject: MX: mx_new_session solely creates a session; handle() is separate --- serve_mx.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/serve_mx.go b/serve_mx.go index f938c02..375a956 100644 --- a/serve_mx.go +++ b/serve_mx.go @@ -213,11 +213,10 @@ func (session *mx_recv_session) handle(ctx context.Context) error { } } -func mx_new_session(ctx context.Context, net_conn net.Conn) error { - session := mx_recv_session{ +func mx_new_session(net_conn net.Conn) mx_recv_session { + return mx_recv_session{ net_conn: net_conn, } - return session.handle(ctx) } func serve_mx() { @@ -243,7 +242,8 @@ func serve_mx() { go func() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - err := mx_new_session(ctx, conn) + session := mx_new_session(conn) + err := session.handle(ctx) if err != nil { if err == err_connection_handler_eof { clog.Info("MX: Connection for " + conn.RemoteAddr().String() + " closed with EOF") -- cgit v1.2.3