c->recv(c, NULL, 0);
}
+ if(c->poll && !c->reapable) {
+ c->poll(c, 0);
+ }
+
return 0;
case SYN_RECEIVED:
c->recv(c, NULL, 0);
}
+ if(c->poll && !c->reapable) {
+ c->poll(c, 0);
+ }
+
return 0;
case CLOSING:
c->rcv.nxt++;
len++;
- // Inform the application that the peer closed the connection.
+ // Inform the application that the peer closed its end of the connection.
if(c->recv) {
errno = 0;
c->recv(c, NULL, 0);
}
utcp_recv_t old_recv = c->recv;
+ utcp_poll_t old_poll = c->poll;
reset_connection(c);
errno = 0;
old_recv(c, NULL, 0);
}
+
+ if(old_poll && !c->reapable) {
+ errno = 0;
+ old_poll(c, 0);
+ }
}
return;
c->recv(c, NULL, 0);
}
- if(c->poll) {
+ if(c->poll && !c->reapable) {
c->poll(c, 0);
}
for(int i = 0; i < utcp->nconnections; i++) {
struct utcp_connection *c = utcp->connections[i];
- if(!c->reapable)
+ if(!c->reapable) {
if(c->recv) {
c->recv(c, NULL, 0);
}
+ if(c->poll && !c->reapable) {
+ c->poll(c, 0);
+ }
+ }
+
buffer_exit(&c->rcvbuf);
buffer_exit(&c->sndbuf);
free(c);