sendRequest reads req.buf after closing req.seq

NewRequest says you can avoid reallocating a new buffer for each request by calling it directly.
This is not true if req.seq is closed before req.buf is read.
This commit is contained in:
aarzilli 2015-11-08 10:56:15 +01:00 committed by Přemysl Janouch
parent 5451e59f88
commit baff8c1906
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 1 additions and 1 deletions

View File

@ -337,9 +337,9 @@ func (c *Conn) sendRequests() {
} }
} }
req.cookie.Sequence = c.newSequenceId() req.cookie.Sequence = c.newSequenceId()
close(req.seq)
c.cookieChan <- req.cookie c.cookieChan <- req.cookie
c.writeBuffer(req.buf) c.writeBuffer(req.buf)
close(req.seq)
} }
response := make(chan struct{}) response := make(chan struct{})
c.closing <- response c.closing <- response