From 2f09b48a892eae7c29780778a5048f1e488c03ff Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Sat, 4 Aug 2018 13:22:54 +0800 Subject: [PATCH] fix crash issue on stream.Write --- stream.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stream.go b/stream.go index 0ccfd96..f044685 100644 --- a/stream.go +++ b/stream.go @@ -99,6 +99,10 @@ func (s *stream) WriteHeader(code int) { s.dp.streamID = s.streamID s.conn.lock.Lock() + if s.conn.closed { + s.conn.lock.Unlock() + return + } ret := C._nghttp2_submit_response(s.conn.session, C.int(s.streamID), C.size_t(uintptr(unsafe.Pointer(&nv[0]))), C.size_t(len(nv)), &s.cdp) s.conn.lock.Unlock()