diff options
Diffstat (limited to 'src/common/socket.cpp')
-rw-r--r-- | src/common/socket.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 023a856..f2e6df6 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -24,11 +24,30 @@ int fd_max; static int currentuse; +static const uint32_t RFIFO_SIZE = 65536; +static const uint32_t WFIFO_SIZE = 65536; struct socket_data *session[FD_SETSIZE]; +/// clean up by discarding handled bytes +inline +void RFIFOFLUSH(int fd) +{ + memmove(session[fd]->rdata, RFIFOP(fd, 0), RFIFOREST(fd)); + session[fd]->rdata_size = RFIFOREST(fd); + session[fd]->rdata_pos = 0; +} + +/// how much room there is to read more data +inline +size_t RFIFOSPACE(int fd) +{ + return session[fd]->max_rdata - session[fd]->rdata_size; +} + + /// Discard all input static void null_parse(int fd); |