From 503997660b52dcd6bc3c0cc7bd2c9263252224d7 Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Mon, 9 Jul 2018 11:24:17 +0800 Subject: [PATCH] add lock on close --- conn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conn.go b/conn.go index f3512eb..cb2dcb9 100644 --- a/conn.go +++ b/conn.go @@ -317,6 +317,9 @@ func (c *ServerConn) serve(s *ServerStream) { // Close close the server connection func (c *ServerConn) Close() error { + c.lock.Lock() + defer c.lock.Unlock() + if c.closed { return nil }