Add method to return the amount of queued outgoing data

This commit is contained in:
Mike Playle 2018-04-01 10:54:05 +01:00
parent 12046f970f
commit 8800d2917e
5 changed files with 34 additions and 1 deletions

View File

@ -122,6 +122,12 @@ public:
*/
int fileno() const;
/**
* The number of outgoing bytes queued on this connection.
* @return size_t
*/
size_t bytesQueued() const;
/**
* Process the TCP connection
*

View File

@ -336,6 +336,12 @@ public:
*/
virtual int fileno() const override { return _socket; }
/**
* The number of outgoing bytes queued on this connection.
* @return size_t
*/
virtual size_t bytesQueued() const { return _out.size(); }
/**
* Process the filedescriptor in the object
* @param monitor Object that can be used to find out if connection object is still alive

View File

@ -158,6 +158,12 @@ public:
*/
virtual int fileno() const override { return _socket; }
/**
* The number of outgoing bytes queued on this connection.
* @return size_t
*/
virtual size_t bytesQueued() const { return _out.size(); }
/**
* Process the filedescriptor in the object
* @param monitor Monitor to check if the object is still alive

View File

@ -43,6 +43,15 @@ int TcpConnection::fileno() const
return _state->fileno();
}
/**
* The number of outgoing bytes queued on this connection.
* @return size_t
*/
size_t TcpConnection::bytesQueued() const
{
return _state->bytesQueued();
}
/**
* Process the TCP connection
* This method should be called when the filedescriptor that is registered

View File

@ -63,6 +63,12 @@ public:
*/
virtual int fileno() const { return -1; }
/**
* The number of outgoing bytes queued on this connection.
* @return size_t
*/
virtual size_t bytesQueued() const { return 0; }
/**
* Process the filedescriptor in the object
*