From ac31db180cfd69d93f323a15610859beb63d0514 Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Sun, 29 Jul 2018 14:11:27 +0800 Subject: [PATCH] fix race condition on map operation --- conn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index 4d64b69..22c5fec 100644 --- a/conn.go +++ b/conn.go @@ -352,11 +352,12 @@ func (c *Conn) Close() error { s.Close() } + c.lock.Lock() + for n := range c.streams { delete(c.streams, n) } - c.lock.Lock() C.nghttp2_session_terminate_session(c.session, 0) C.nghttp2_session_del(c.session) c.lock.Unlock()