fix crash issue on stream.Write

master
fangdingjun 6 years ago
parent 0a79b2882d
commit 2f09b48a89

@ -99,6 +99,10 @@ func (s *stream) WriteHeader(code int) {
s.dp.streamID = s.streamID s.dp.streamID = s.streamID
s.conn.lock.Lock() 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), 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) C.size_t(uintptr(unsafe.Pointer(&nv[0]))), C.size_t(len(nv)), &s.cdp)
s.conn.lock.Unlock() s.conn.lock.Unlock()

Loading…
Cancel
Save