diff options
author | Runxi Yu <me@runxiyu.org> | 2025-01-16 16:35:34 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-01-16 16:35:34 +0800 |
commit | 23974469f387b20dc77bb2f66f8100922c85d93c (patch) | |
tree | b29bf2d8deed09402e2413fd50c554813869cf3b | |
parent | Remove IMAP again for now (diff) | |
download | maild-23974469f387b20dc77bb2f66f8100922c85d93c.tar.gz maild-23974469f387b20dc77bb2f66f8100922c85d93c.tar.zst maild-23974469f387b20dc77bb2f66f8100922c85d93c.zip |
MX: mx_new_session solely creates a session; handle() is separate
-rw-r--r-- | serve_mx.go | 8 |
1 files 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") |