* cancelled.
*/
int ev_fd_enable(ev_source *ev, ev_fdmode mode, int fd) {
+ assert(fd >= 0);
D(("enabling mode %s fd %d", modenames[mode], fd));
FD_SET(fd, &ev->mode[mode].enabled);
return 0;
if(w->fd == -1)
return 0; /* already shut down */
- info("writer_shutdown fd=%d", w->fd);
+ info("writer_shutdown fd=%d error=%d", w->fd, w->error);
ev_timeout_cancel(ev, w->timeout);
ev_fd_cancel(ev, ev_write, w->fd);
w->timeout = 0;
if(w->reader) {
+ info("found a tied reader");
/* If there is a reader still around we just untie it */
w->reader->writer = 0;
shutdown(w->fd, SHUT_WR); /* there'll be no more writes */
} else {
+ info("no tied reader");
/* There's no reader so we are free to close the FD */
xclose(w->fd);
}
if(!n)
return 0; /* avoid silliness */
+ if(w->fd == -1)
+ error(0, "ev_writer_write on %s after shutdown", w->what);
if(w->spacebound && w->b.end - w->b.start + n > w->spacebound) {
/* The new buffer contents will exceed the space bound. We assume that the
* remote client has gone away and TCP hasn't noticed yet, or that it's got
ev_fd_cancel(ev, ev_read, r->fd);
r->eof = 1;
if(r->writer) {
+ info("found a tied writer");
/* If there is a writer still around we just untie it */
r->writer->reader = 0;
shutdown(r->fd, SHUT_RD); /* there'll be no more reads */
} else {
+ info("no tied writer found");
/* There's no writer so we are free to close the FD */
xclose(r->fd);
}