From ef1d91be310b939a2d6249ca83f9fee3dd67344a Mon Sep 17 00:00:00 2001 From: dwmalone Date: Sat, 27 Jul 2002 23:06:52 +0000 Subject: If a socket is disconnected for some reason (like a TCP connection not responding) then drop any data on the outgoing queue in soisdisconnected because there is no way to get it to its destination any longer. The only objection to this patch I got on -net was from Terry, who wasn't sure that the condition in question could arise, so I provided some example code. --- sys/kern/uipc_sockbuf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/kern/uipc_sockbuf.c') diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index f917cdb..8b36396 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -158,6 +158,7 @@ soisdisconnected(so) so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED); wakeup(&so->so_timeo); + sbdrop(&so->so_snd, so->so_snd.sb_cc); sowwakeup(so); sorwakeup(so); } -- cgit v1.1