Merge pull request #320 from CopernicaMarketingSoftware/timoutFix
Fixed issue where timeout triggered an invalid error
This commit is contained in:
commit
5ca2d77ae3
|
|
@ -197,13 +197,22 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Is the connection ready to accept instructions / has passed the login handshake?
|
||||
* Is the connection ready to accept instructions / has passed the login handshake and not closed?
|
||||
* @return bool
|
||||
*/
|
||||
bool ready() const
|
||||
{
|
||||
return _implementation.ready();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is (or was) the connection initialized
|
||||
* @return bool
|
||||
*/
|
||||
bool initialized() const
|
||||
{
|
||||
return _implementation.initialized();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the connection in a usable state, or is it already closed or
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ public:
|
|||
|
||||
/**
|
||||
* Are we fully connected and ready for instructions? This is true after the initial
|
||||
* protocol and login handshake were completed.
|
||||
* protocol and login handshake were completed and the connection is not closed.
|
||||
* @return bool
|
||||
*/
|
||||
bool ready() const
|
||||
|
|
@ -228,6 +228,17 @@ public:
|
|||
return _state == state_connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is (or was) the connection initialized
|
||||
* @return bool
|
||||
*/
|
||||
bool initialized() const
|
||||
{
|
||||
// We are initalized if we have passed the initialized state. So we are in
|
||||
// a connected, closing, or closed state.
|
||||
return _state == state_connected || _state == state_closing || _state == state_closed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Are we closing down?
|
||||
* @return bool
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ private:
|
|||
|
||||
// timer is no longer active, so the refcounter in the loop is restored
|
||||
ev_ref(_loop);
|
||||
|
||||
|
||||
// if the onNegotiate method was not yet called, and no heartbeat timeout was negotiated
|
||||
if (_timeout == 0)
|
||||
{
|
||||
|
|
@ -243,10 +243,10 @@ private:
|
|||
// in either case we're no longer going to run further timers.
|
||||
_next = _expire = 0.0;
|
||||
|
||||
// if we have a valid connection, user-space must have overridden the onNegotiate
|
||||
// if we have an initialized connection, user-space must have overridden the onNegotiate
|
||||
// method, so we keep using the connection
|
||||
if (_connection->ready()) return;
|
||||
|
||||
if (_connection->initialized()) return;
|
||||
|
||||
// this is a connection timeout, close the connection from our side too
|
||||
return (void)_connection->close(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ private:
|
|||
* @friend
|
||||
*/
|
||||
friend TcpChannel;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Method that is called when the RabbitMQ server and your client application
|
||||
|
|
@ -237,13 +237,24 @@ public:
|
|||
bool close(bool immediate = false);
|
||||
|
||||
/**
|
||||
* Is the connection connected, meaning: it has passed the login handshake?
|
||||
* Is the connection connected, meaning: it has passed the login handshake
|
||||
* and isn't closed yet?
|
||||
* @return bool
|
||||
*/
|
||||
bool ready() const
|
||||
{
|
||||
return _connection.ready();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the connection initialized, meaning: it has passed the login handshake?
|
||||
* It may be closing or closed
|
||||
* @return bool
|
||||
*/
|
||||
bool initialized() const
|
||||
{
|
||||
return _connection.initialized();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the connection in a usable state / not yet closed or being closed
|
||||
|
|
|
|||
Loading…
Reference in New Issue