Using recv instead of read, for slightly non-blocking reads, without losing blocking writes
This commit is contained in:
1 parent
9eb796bf94
commit
5a5be19518
3 files changed
+7
-9
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user