From baff8c19067489ea26bbb804ef693e966202b511 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Sun, 8 Nov 2015 10:56:15 +0100 Subject: [PATCH] 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. --- nexgb/xgb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nexgb/xgb.go b/nexgb/xgb.go index 487ae16..44634fe 100644 --- a/nexgb/xgb.go +++ b/nexgb/xgb.go @@ -337,9 +337,9 @@ func (c *Conn) sendRequests() { } } req.cookie.Sequence = c.newSequenceId() - close(req.seq) c.cookieChan <- req.cookie c.writeBuffer(req.buf) + close(req.seq) } response := make(chan struct{}) c.closing <- response