added connection::usable()

This commit is contained in:
Emiel Bruijntjes 2018-11-12 15:19:31 +01:00
parent a80847dc5e
commit 6432ce2ec1
3 changed files with 28 additions and 0 deletions

View File

@ -196,6 +196,16 @@ public:
return _implementation.expected();
}
/**
* Is the connection in a usable state, or is it already closed or
* in the process of being closed?
* @return bool
*/
bool usable() const
{
return _implementation.usable();
}
/**
* Close the connection
* This will close all channels

View File

@ -253,6 +253,15 @@ public:
return _state == state_closed;
}
/**
* Is the connection in a usable state / not yet closed?
* @return bool
*/
bool usable() const
{
return (_state == state_protocol || _state == state_handshake || _state == state_connected) && !_closed;
}
/**
* Mark the connection as ready
*/

View File

@ -236,6 +236,15 @@ public:
*/
bool close(bool immediate = false);
/**
* Is the connection in a usable state / not yet closed or being closed
* @return bool
*/
bool usable() const
{
return _connection.usable();
}
/**
* The max frame size. Useful if you set up a buffer to parse incoming data: it does not have to exceed this size.
* @return uint32_t