getBufferedAmount should only see totalLength

This commit is contained in:
Alex Hultman
2021-09-20 15:13:11 +00:00
parent 3eefc51c08
commit 34cadcee27
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -134,7 +134,8 @@ protected:
/* Returns the user space backpressure. */ /* Returns the user space backpressure. */
unsigned int getBufferedAmount() { unsigned int getBufferedAmount() {
return (unsigned int) getAsyncSocketData()->buffer.size(); /* We return the actual amount of bytes in backbuffer, including pendingRemoval */
return (unsigned int) getAsyncSocketData()->buffer.totalLength();
} }
/* Returns the text representation of an IPv4 or IPv6 address */ /* Returns the text representation of an IPv4 or IPv6 address */
+4
View File
@@ -62,6 +62,10 @@ struct BackPressure {
size_t size() { size_t size() {
return length(); return length();
} }
/* The total length, incuding pending removal */
size_t totalLength() {
return buffer.length();
}
}; };
/* Depending on how we want AsyncSocket to function, this will need to change */ /* Depending on how we want AsyncSocket to function, this will need to change */