Merge pull request #206 from MikePlayle/master

Add method to return the amount of queued outgoing data
This commit is contained in:
Emiel Bruijntjes 2018-04-01 22:23:13 +02:00 committed by GitHub
commit 0eb14c9756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 1 deletions

View File

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

View File

@ -335,6 +335,12 @@ public:
* @return int * @return int
*/ */
virtual int fileno() const override { return _socket; } 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 * Process the filedescriptor in the object

View File

@ -157,7 +157,13 @@ public:
* @return int * @return int
*/ */
virtual int fileno() const override { return _socket; } 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 * Process the filedescriptor in the object
* @param monitor Monitor to check if the object is still alive * @param monitor Monitor to check if the object is still alive

View File

@ -43,6 +43,15 @@ int TcpConnection::fileno() const
return _state->fileno(); 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 * Process the TCP connection
* This method should be called when the filedescriptor that is registered * This method should be called when the filedescriptor that is registered

View File

@ -63,6 +63,12 @@ public:
*/ */
virtual int fileno() const { return -1; } 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 * Process the filedescriptor in the object
* *