Skip to content

Commit

Permalink
Merge pull request #7 from rdbrck/check_for_login_errors
Browse files Browse the repository at this point in the history
Check the response to the CONNECT frame to see if there was an error
  • Loading branch information
ankneo committed Jun 3, 2016
2 parents 0fff0fa + 8449534 commit a6b0145
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/resty/rabbitmqstomp.lua
Expand Up @@ -116,8 +116,18 @@ function _login(self)
return nil, err
end

local frame, err = _receive_frame(self)
if not frame then
return nil, err
end

-- We successfully received a frame, but it was an ERROR frame
if sub( frame, 1, len( 'ERROR' ) ) == 'ERROR' then
return nil, frame
end

self.state = STATE_CONNECTED
return _receive_frame(self)
return frame
end


Expand Down

0 comments on commit a6b0145

Please sign in to comment.