From owner-freebsd-net Tue May 11 3: 8:51 1999 Delivered-To: freebsd-net@freebsd.org Received: from patriot.wipinfo.soft.net (patriot.wipinfo.soft.net [164.164.6.21]) by hub.freebsd.org (Postfix) with ESMTP id E996D15973 for ; Tue, 11 May 1999 03:08:45 -0700 (PDT) (envelope-from ajit@wipinfo.soft.net) Received: from voyager.wipinfo.soft.net (ajit@voyager [192.168.151.87]) by patriot.wipinfo.soft.net (8.9.2/8.9.2) with ESMTP id PAA27897 for ; Tue, 11 May 1999 15:41:01 -0500 (GMT) Received: from localhost (ajit@localhost) by voyager.wipinfo.soft.net (8.9.1/8.8.5) with ESMTP id PAA22267 for ; Tue, 11 May 1999 15:42:50 +0530 X-Authentication-Warning: voyager.wipinfo.soft.net: ajit owned process doing -bs Date: Tue, 11 May 1999 15:42:50 +0530 (IST) From: Ajit Shimpi To: freebsd-net@FreeBSD.ORG Subject: socket close() Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, I am going through socket layer implementation of close() system call (4.4BSD Lite-2 sources). In the function soclose() (file : kern/uipc_socket.c), sofree() is called. In sofree(), one of the first checks made is whether so->so_pcb field of socket structure (so) is NULL. This, I feel, is non-null, since soclose() calls PRU_DISCONNECT and then PRU_DETACH user requests. The tcp_usrreq() function handles these requests by calling tcp_disconnect() for connection in ESTABLISHED state. If the "so_pcb" field is non-null, sofree() returns without freeing socket structure (so). Can anyone explain if the PCB associated with the socket is freed for ESABLISHED connections? Or is it a defect? [ Btw, tcp_close() does all the freeing job; but is never called for TCP connections in ESTABLISHED state.] Thanks in advance, Ajit. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message