if (s->bytes_left == 0) {
if (epoll_ctl(ep_fd, EPOLL_CTL_DEL, s->fd, NULL) == -1) {
- perror("EPOLL_CTL_ADD");
+ perror("EPOLL_CTL_DEL");
exit(1);
}
close(s->fd);
ret = read(sock, buf, 65536);
if (ret == 0) {
- close(sock);
-
if (epoll_ctl(ep_fd, EPOLL_CTL_DEL, sock, NULL) == -1) {
- perror("EPOLL_CTL_ADD");
+ perror("EPOLL_CTL_DEL");
exit(1);
}
-
+ close(sock);
continue;
}