From owner-freebsd-net Sun Apr 28 16:37:53 2002 Delivered-To: freebsd-net@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 6071137B400 for ; Sun, 28 Apr 2002 16:37:47 -0700 (PDT) Received: from gosset.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 29 Apr 2002 00:37:46 +0100 (BST) To: net@freebsd.org Subject: soisdisconnected tweak. X-Request-Do: Date: Mon, 29 Apr 2002 00:37:46 +0100 From: David Malone Message-ID: <200204290037.aa51029@salmon.maths.tcd.ie> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message