Fixed bandwidth sometimes being wrongly measured.

This commit is contained in:
Thulinma 2016-06-09 18:43:16 +02:00
parent ed982b9eb3
commit 6babfe64c6
5 changed files with 10 additions and 16 deletions

View file

@ -209,6 +209,12 @@ Socket::Connection::Connection() {
Blocking = false;
} //Socket::Connection basic constructor
void Socket::Connection::resetCounter(){
up = 0;
down = 0;
}
/// Internally used call to make an file descriptor blocking or not.
void setFDBlocking(int FD, bool blocking) {
int flags = fcntl(FD, F_GETFL, 0);

View file

@ -90,6 +90,7 @@ namespace Socket {
unsigned int connTime();///< Returns the time this socket has been connected.
uint64_t dataUp(); ///< Returns total amount of bytes sent.
uint64_t dataDown(); ///< Returns total amount of bytes received.
void resetCounter(); ///< Resets the up/down bytes counter to zero.
std::string getStats(std::string C); ///< Returns a std::string of stats, ended by a newline.
friend class Server;
bool Error; ///< Set to true if a socket error happened.