Added ability for sockets to override their byte counters
This commit is contained in:
		
							parent
							
								
									6f08fcd371
								
							
						
					
					
						commit
						23f0c388b5
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		|  | @ -237,6 +237,14 @@ void Socket::Connection::resetCounter(){ | |||
|   down = 0; | ||||
| } | ||||
| 
 | ||||
| void Socket::Connection::addUp(const uint32_t i){ | ||||
|   up += i; | ||||
| } | ||||
| 
 | ||||
| void Socket::Connection::addDown(const uint32_t i){ | ||||
|   down += i; | ||||
| } | ||||
| 
 | ||||
| /// Internally used call to make an file descriptor blocking or not.
 | ||||
| void setFDBlocking(int FD, bool blocking){ | ||||
|   int flags = fcntl(FD, F_GETFL, 0); | ||||
|  |  | |||
|  | @ -94,6 +94,8 @@ namespace Socket{ | |||
|     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.
 | ||||
|     void addUp(const uint32_t i); | ||||
|     void addDown(const uint32_t i); | ||||
|     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.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma