When soisdisconnected is called on a socket, the connection is
marked as broken the socket can't recieve or send any more data.
As far as I can tell, any data which is queued for output cannot
be sent, but remains queued in the socket until it is closed.

The patch below makes soisdisconnected drop whatever data is queued,
so that the mbufs can be reused straight away and you don't have
to wait for the socket to be closed.

I've been running this patch on several 4.X machines for some time
and on my -current box at home with no side effects. I wonder if
there is any reason not to commit it?

        David.


Index: sys/kern/uipc_socket2.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.85
diff -u -r1.85 uipc_socket2.c
--- sys/kern/uipc_socket2.c     20 Mar 2002 04:39:32 -0000      1.85
+++ sys/kern/uipc_socket2.c     24 Mar 2002 09:21:50 -0000
@@ -157,6 +157,7 @@
        so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
        so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED);
        wakeup((caddr_t)&so->so_timeo);
+       sbdrop(&so->so_snd, so->so_snd.sb_cc);
        sowwakeup(so);
        sorwakeup(so);
 }

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to