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

dont cause internal errors to close the connection

If reading a frame from a framer returns an error it is returned
out to recv() which will close the connection and cancel all
inflight requests. Some errors are not fatal for all requests so
only return this erorr out for net errors.
Chris Bannister преди 10 години
родител
ревизия
2c4f859917
променени са 1 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 6 4
      conn.go

+ 6 - 4
conn.go

@@ -327,13 +327,15 @@ func (c *Conn) recv() error {
 	call := &c.calls[head.stream]
 	err = call.framer.readFrame(&head)
 	if err != nil {
-		return err
+		// only net errors should cause the connection to be closed. Though
+		// cassandra returning corrupt frames will be returned here as well.
+		if _, ok := err.(net.Error); ok {
+			return err
+		}
 	}
 
-	// once we get to here we know that the caller must be waiting and that there
-	// is no error.
 	select {
-	case call.resp <- nil:
+	case call.resp <- err:
 	default:
 		// in case the caller timedout
 	}