Skip to content

Commit

Permalink
Drop Connection On Connection Errors in Sca/Query Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed Jul 16, 2015
1 parent c392b5e commit 0f1e4cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions query_record_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package aerospike

import (

// . "github.com/aerospike/aerospike-client-go/logger"

. "github.com/aerospike/aerospike-client-go/types"
Expand Down Expand Up @@ -47,7 +46,9 @@ func (cmd *queryRecordCommand) parseRecordResults(ifc command, receiveSize int)
if resultCode == KEY_NOT_FOUND_ERROR {
// consume the rest of the input buffer from the socket
if cmd.dataOffset < receiveSize {
cmd.readBytes(receiveSize - cmd.dataOffset)
if err := cmd.readBytes(receiveSize - cmd.dataOffset); err != nil {
return false, err
}
}
return false, nil
}
Expand Down
4 changes: 3 additions & 1 deletion scan_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ func (cmd *scanCommand) parseRecordResults(ifc command, receiveSize int) (bool,
if resultCode == KEY_NOT_FOUND_ERROR {
// consume the rest of the input buffer from the socket
if cmd.dataOffset < receiveSize {
cmd.readBytes(receiveSize - cmd.dataOffset)
if err := cmd.readBytes(receiveSize - cmd.dataOffset); err != nil {
return false, err
}
}
return false, nil
}
Expand Down

3 comments on commit 0f1e4cd

@ericdmann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(thumbsup)

@GeertJohan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍 , I totally missed this one when searching for the problem in #70.
@khaf This is a nice tool to catch missing error checks: github.com/kisielk/errcheck

@khaf
Copy link
Collaborator Author

@khaf khaf commented on 0f1e4cd Jul 17, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeertJohan Yes I have to add errcheck to our build process.

Please sign in to comment.