continue;
/* else failed */
- so->so_state = SS_NOFDREF;
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
}
/* else so->so_state &= ~SS_ISFCONNECTING; */
continue; /* Still connecting, continue */
/* else failed */
- so->so_state = SS_NOFDREF;
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
/* tcp_input will take care of it */
} else {
errno == EINPROGRESS || errno == ENOTCONN)
continue;
/* else failed */
- so->so_state = SS_NOFDREF;
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
} else
so->so_state &= ~SS_ISFCONNECTING;
*/
if (so->so_expire)
so->so_expire = curtime + SO_EXPIRE;
- so->so_state = SS_ISFCONNECTED; /* So that it gets select()ed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_ISFCONNECTED; /* So that it gets select()ed */
return 0;
}
if (flags & SS_FACCEPTONCE)
so->so_tcpcb->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT*2;
- so->so_state = (SS_FACCEPTCONN|flags);
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= (SS_FACCEPTCONN | flags);
so->so_lport = lport; /* Kept in network format */
so->so_laddr.s_addr = laddr; /* Ditto */
}
}
so->so_state &= ~(SS_ISFCONNECTING);
- if (so->so_state & SS_FCANTSENDMORE)
- so->so_state = SS_NOFDREF; /* Don't select it */ /* XXX close() here as well? */
- else
+ if (so->so_state & SS_FCANTSENDMORE) {
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF; /* Don't select it */
+ } else {
so->so_state |= SS_FCANTRCVMORE;
+ }
}
static void
}
}
so->so_state &= ~(SS_ISFCONNECTING);
- if (so->so_state & SS_FCANTRCVMORE)
- so->so_state = SS_NOFDREF; /* as above */
- else
+ if (so->so_state & SS_FCANTRCVMORE) {
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF; /* as above */
+ } else {
so->so_state |= SS_FCANTSENDMORE;
+ }
}
void
#define SS_FACCEPTCONN 0x100 /* Socket is accepting connections from a host on the internet */
#define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
+#define SS_PERSISTENT_MASK 0xf000 /* Unremovable state bits */
+
extern struct socket tcb;
struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
soisfconnected(so);
so->so_state &= ~SS_CTL; /* success XXX */
} else if (ret == 2) {
- so->so_state = SS_NOFDREF; /* CTL_CMD */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF; /* CTL_CMD */
} else {
needoutput = 1;
tp->t_state = TCPS_FIN_WAIT_1;
if (flags != SS_FACCEPTONCE)
so->so_expire = 0;
- so->so_state = SS_ISFCONNECTED;
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_ISFCONNECTED;
return so;
}