소스 검색

dont close the channel, store not waiting

Chris Bannister 10 년 전
부모
커밋
9262dc285f
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      conn.go

+ 1 - 2
conn.go

@@ -611,12 +611,11 @@ func (c *Conn) closeWithError(err error) {
 		req := &c.calls[id]
 		// we need to send the error to all waiting queries, put the state
 		// of this conn into not active so that it can not execute any queries.
+		atomic.StoreInt32(&req.waiting, 0)
 		select {
 		case req.resp <- err:
 		default:
 		}
-
-		close(req.resp)
 	}
 
 	c.conn.Close()