accept(2) on a socket that has been shutdown(2) normally returns
ECONNABORTED. Make this happen in the non-blocking case as well. The previous behavior was to return EAGAIN, which (a) is not consistent with the blocking case and (b) causes the application to think the socket is still valid. PR: bin/42100 Reviewed by: freebsd-net MFC after: 3 days
This commit is contained in:
parent
b20ea17938
commit
f2f03122c3
@ -268,16 +268,15 @@ accept1(td, uap, compat)
|
||||
error = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if ((head->so_state & SS_NBIO) && TAILQ_EMPTY(&head->so_comp)) {
|
||||
splx(s);
|
||||
error = EWOULDBLOCK;
|
||||
goto done;
|
||||
}
|
||||
while (TAILQ_EMPTY(&head->so_comp) && head->so_error == 0) {
|
||||
if (head->so_state & SS_CANTRCVMORE) {
|
||||
head->so_error = ECONNABORTED;
|
||||
break;
|
||||
}
|
||||
if ((head->so_state & SS_NBIO) != 0) {
|
||||
head->so_error = EWOULDBLOCK;
|
||||
break;
|
||||
}
|
||||
error = tsleep(&head->so_timeo, PSOCK | PCATCH,
|
||||
"accept", 0);
|
||||
if (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user