Skip to content

Commit

Permalink
fix: better check for the need of sending a startup message
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jul 15, 2015
1 parent 48e7796 commit ba9ed20
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cassandra/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ local function startup(self)

if response.op_code == self.constants.op_codes.AUTHENTICATE then
return answer_auth(self, response)
elseif response.op_code == self.constants.op_codes.ERROR then
return false, self.reader:read_error(response.buffer)
elseif response.op_code ~= self.constants.op_codes.READY then
return false, cerror("server is not ready")
end
Expand Down Expand Up @@ -143,7 +145,7 @@ function _M:connect(contact_points, port, options)

self.authenticator = options.authenticator

if not self.ready then
if self.socket_type ~= "ngx" or self:get_reused_times() < 1 then
self.ready, err = startup(self)
if not self.ready then
return false, err
Expand Down

0 comments on commit ba9ed20

Please sign in to comment.