Don't allow socket close while writing h2 headers

This commit is contained in:
Asim Aslam 2019-09-10 18:26:12 -07:00
parent 3e3bbe3fd0
commit 6ec32805d0

View File

@ -316,6 +316,10 @@ func (h *httpTransportSocket) Send(m *Message) error {
// no op // no op
} }
// we need to lock to protect the write
h.mtx.RLock()
defer h.mtx.RUnlock()
// set headers // set headers
for k, v := range m.Header { for k, v := range m.Header {
h.w.Header().Set(k, v) h.w.Header().Set(k, v)