فهرست منبع

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
 	}