Skip to content
Browse files

always read pending data; fixes #129

From the kqueue man page: “It is possible for EOF to be returned
(indicating the con- nection is gone) while there is still data
pending in the socket buffer.”
  • Loading branch information...
1 parent 236c669 commit a9d436718ad9d8c60a250dd0269feac5f1287a52 @kr committed
Showing with 2 additions and 9 deletions.
  1. +0 −5 prot.c
  2. +1 −3 sock-bsd.c
  3. +1 −1 sock-linux.c
View
5 prot.c
@@ -1777,11 +1777,6 @@ h_conn(const int fd, const short which, Conn *c)
return;
}
- if (which == 'h') {
- connclose(c);
- return;
- }
-
conn_data(c);
while (cmd_data_ready(c) && (c->cmd_len = cmd_len(c))) do_cmd(c);
update_conns();
View
4 sock-bsd.c
@@ -108,9 +108,7 @@ sockmain()
static void
handle(Socket *s, int filt, int flags)
{
- if (flags & EV_EOF) {
- s->f(s->x, 'h');
- } else if (filt == EVFILT_READ) {
+ if (filt == EVFILT_READ) {
s->f(s->x, 'r');
} else if (filt == EVFILT_WRITE) {
s->f(s->x, 'w');
View
2 sock-linux.c
@@ -96,7 +96,7 @@ handle(Socket *s, int evset)
int c = 0;
if (evset & (EPOLLHUP|EPOLLRDHUP)) {
- c = 'h';
+ c = 'r';
} else if (evset & EPOLLIN) {
c = 'r';
} else if (evset & EPOLLOUT) {

0 comments on commit a9d4367

Please sign in to comment.
Something went wrong with that request. Please try again.