diff --git a/guacamole/proxy/guacio.c b/guacamole/proxy/guacio.c index f102e432e..f14d9a2f9 100644 --- a/guacamole/proxy/guacio.c +++ b/guacamole/proxy/guacio.c @@ -18,17 +18,11 @@ char __GUACIO_BAS64_CHARACTERS[64] = { GUACIO* guac_open(int fd) { - int flags; - GUACIO* io = malloc(sizeof(GUACIO)); io->ready = 0; io->written = 0; io->fd = fd; - /* Set O_NONBLOCK */ - flags = fcntl(io->fd, F_GETFL, 0); - fcntl(io->fd, F_SETFL, flags | O_NONBLOCK); - /* Allocate instruction buffer */ io->instructionbuf_size = 1024; io->instructionbuf = malloc(io->instructionbuf_size); diff --git a/guacamole/proxy/guacio.h b/guacamole/proxy/guacio.h index 8f9059539..2529c47ba 100644 --- a/guacamole/proxy/guacio.h +++ b/guacamole/proxy/guacio.h @@ -6,7 +6,7 @@ typedef struct GUACIO { - int fd; + int fd; int ready; int ready_buf[3]; diff --git a/guacamole/proxy/protocol.c b/guacamole/proxy/protocol.c index 76681d9f7..ed525dc0b 100644 --- a/guacamole/proxy/protocol.c +++ b/guacamole/proxy/protocol.c @@ -4,6 +4,9 @@ #include #include +#include +#include + #include "guacio.h" #include "protocol.h" @@ -181,10 +184,11 @@ int __guac_fill_instructionbuf(GUACIO* io) { int retval; /* Attempt to fill buffer */ - retval = read( + retval = recv( io->fd, io->instructionbuf + io->instructionbuf_used_length, - io->instructionbuf_size - io->instructionbuf_used_length + io->instructionbuf_size - io->instructionbuf_used_length, + 0 ); if (retval < 0)