int syncsocket_stop_read(SyncSocket* ssocket) { if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) { errno = EINVAL; return -1; } iolooper_del_read(ssocket->iolooper, ssocket->fd); return 0; }
void iolooper_modify( IoLooper* iol, int fd, int oldflags, int newflags ) { if (fd < 0) return; int changed = oldflags ^ newflags; if ((changed & IOLOOPER_READ) != 0) { if ((newflags & IOLOOPER_READ) != 0) iolooper_add_read(iol, fd); else iolooper_del_read(iol, fd); } if ((changed & IOLOOPER_WRITE) != 0) { if ((newflags & IOLOOPER_WRITE) != 0) iolooper_add_write(iol, fd); else iolooper_del_write(iol, fd); } }