diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/socket.c | 11 | ||||
-rw-r--r-- | src/common/socket.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index fafa229df..19a2ecdea 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -283,14 +283,19 @@ static int send_from_fifo(int fd) return 0; } -void flush_fifo(int fd) +void flush_fifo(int fd, int lock) { - if(session[fd] != NULL && session[fd]->func_send == send_from_fifo) - { + if(session[fd] == NULL || session[fd]->func_send != send_from_fifo) + return; + if (lock) + { //Lock the thread until data is sent. set_nonblocking(fd, 1); send_from_fifo(fd); set_nonblocking(fd, 0); + return; } + //Send without locking the thread. + send_from_fifo(fd); } void flush_fifos(void) diff --git a/src/common/socket.h b/src/common/socket.h index 9552575f3..b1565b488 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -158,7 +158,7 @@ void do_close(int fd); void socket_init(void); void socket_final(void); -extern void flush_fifo(int fd); +extern void flush_fifo(int fd, int lock); extern void flush_fifos(void); extern void set_nonblocking(int fd, int yes); |