- if ((so->so_state & SS_ISDISCONNECTING) &&
- (so->so_options & SO_NBIO)) {
- u.u_error = EINPROGRESS;
+ if ((so->so_options & SO_DONTLINGER) == 0) {
+ if ((so->so_state & SS_ISDISCONNECTING) &&
+ (so->so_state & SS_NBIO) &&
+ exiting == 0)
+ return (EINPROGRESS);
+ /* should use tsleep here, for at most linger */
+ while (so->so_state & SS_ISCONNECTED)
+ sleep((caddr_t)&so->so_timeo, PZERO+1);
+ }
+ }
+drop:
+ if (so->so_pcb) {
+ error = (*so->so_proto->pr_usrreq)(so, PRU_DETACH,
+ (struct mbuf *)0, (struct mbuf *)0, (struct socketopt *)0);
+ if (exiting == 0 && error) {