Преглед на файлове

Merge pull request #469 from Zariel/conn-exhaust-streams

conn: release the stream when recieving an error
Chris Bannister преди 10 години
родител
ревизия
5c2d890450
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      conn.go

+ 7 - 0
conn.go

@@ -468,6 +468,13 @@ func (c *Conn) exec(req frameWriter, tracer Tracer) (frame, error) {
 	select {
 	case err := <-call.resp:
 		if err != nil {
+			if !c.Closed() {
+				// if the connection is closed then we cant release the stream,
+				// this is because the request is still outstanding and we have
+				// been handed another error from another stream which caused the
+				// connection to close.
+				c.releaseStream(stream)
+			}
 			return nil, err
 		}
 	case <-time.After(c.timeout):