Acquire socket lock in the "waiting for connection" loop in

kern_connect(), replacing tsleep() with msleep() with the socket
mutex.
This commit is contained in:
Robert Watson 2004-06-24 01:43:23 +00:00
parent 3f11a2f374
commit ad6b0efff5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131007

View File

@ -501,8 +501,10 @@ kern_connect(td, fd, sa)
goto done1;
}
s = splnet();
SOCK_LOCK(so);
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
error = tsleep(&so->so_timeo, PSOCK | PCATCH, "connec", 0);
error = msleep(&so->so_timeo, SOCK_MTX(so), PSOCK | PCATCH,
"connec", 0);
if (error) {
if (error == EINTR || error == ERESTART)
interrupted = 1;
@ -513,6 +515,7 @@ kern_connect(td, fd, sa)
error = so->so_error;
so->so_error = 0;
}
SOCK_UNLOCK(so);
splx(s);
bad:
if (!interrupted)