FreeBSD/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
/*
 * Initiate or continue a disconnect.
 * If embryonic state, just send reset (once).
 * If in ``let data drain'' option and linger null, just drop.
 * Otherwise (hard), mark socket disconnecting and drop
 * current input data; switch states based on user close, and
 * send segment to peer (with FIN).
 */
Initiate or continue a disconnect.
If embryonic state, just send reset (once).
If in ``let data drain'' option and linger null, just drop.
Otherwise (hard), mark socket disconnecting and drop
current input data; switch states based on user close, and
send segment to peer (with FIN).
Initiate or continue a disconnect . If embryonic state just send reset ( once ) . If in ` ` let data drain ' ' option and linger null just drop . Otherwise ( hard ) mark socket disconnecting and drop current input data ; switch states based on user close and send segment to peer ( with FIN ) .
static void
sdp_start_disconnect(struct sdp_sock *ssk)
{
	struct socket *so;
	int unread;
	so = ssk->socket;
	SDP_WLOCK_ASSERT(ssk);
	sdp_stop_keepalive_timer(so);
	if (ssk->state < TCPS_ESTABLISHED) {
		ssk = sdp_closed(ssk);
		KASSERT(ssk != NULL,
		    ("sdp_start_disconnect: sdp_close() returned NULL"));
	} else if ((so->so_options & SO_LINGER) && so->so_linger == 0) {
		ssk = sdp_drop(ssk, 0);
		KASSERT(ssk != NULL,
		    ("sdp_start_disconnect: sdp_drop() returned NULL"));
	} else {
		soisdisconnecting(so);
		unread = sbused(&so->so_rcv);
		sbflush(&so->so_rcv);
		sdp_usrclosed(ssk);
		if (!(ssk->flags & SDP_DROPPED)) {
			if (unread)
				sdp_output_reset(ssk);
			else
				sdp_output_disconnect(ssk);
		}
	}
}
static void sdp_start_disconnect ( struct sdp_sock * ssk ) { struct socket * so ; int unread ; so = ssk -> socket ; SDP_WLOCK_ASSERT ( ssk ) ; sdp_stop_keepalive_timer ( so ) ; if ( ssk -> state < TCPS_ESTABLISHED ) { ssk = sdp_closed ( ssk ) ; KASSERT ( ssk != NULL , ( " " ) ) ; } else if ( ( so -> so_options & SO_LINGER ) && so -> so_linger == 0 ) { ssk = sdp_drop ( ssk , 0 ) ; KASSERT ( ssk != NULL , ( " " ) ) ; } else { soisdisconnecting ( so ) ; unread = sbused ( & so -> so_rcv ) ; sbflush ( & so -> so_rcv ) ; sdp_usrclosed ( ssk ) ; if ( ! ( ssk -> flags & SDP_DROPPED ) ) { if ( unread ) sdp_output_reset ( ssk ) ; else sdp_output_disconnect ( ssk ) ; } } }
Initiate or continue a disconnect.
Initiate or continue a disconnect .
/*
	 * Neither sdp_closed() nor sdp_drop() should return NULL, as the
	 * socket is still open.
	 */