c = next;
next = c->next_conn;
#if HAVE_POLL
- if (fds[c->sock].revents & (POLLERR|POLLHUP|POLLNVAL)) {
- destroy_conn(c);
- continue;
- }
- if (!fds[c->sock].revents & POLLIN) {
+ if (!fds[c->sock].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL)) {
continue;
}
#else
* client has closed the socket. If we get a return value
* of -1 (error), we close the socket ourselves.
*
- * Just to be safe, we include this code for poll() as
- * well.
+ * We do the same for poll(), even though we actually have
+ * bits that tell us what is happening (in case of new
+ * input AND error/hangup at the same time, we do an
+ * explicit check at the bottom of the loop as well).
*/
destroy_conn(c);
continue;
c->buf_len += bytes_avail;
parse_command(c);
+
+ if (fds[c->sock].revents & (POLLERR|POLLHUP|POLLNVAL)) {
+ destroy_conn(c);
+ continue;
+ }
}
return checked_through;
}
int do_upload(struct ftran *f)
{
char upload_buf[16384];
- int avail, size;
+ int size;
#if WANT_ASCII
/* keep buffer size small in ascii transfers
to prevent process stalling while filtering