Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2002 03:54:49 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        net@freebsd.org
Subject:   Re: soisdisconnected tweak.
Message-ID:  <3CCD2679.B5D5A709@mindspring.com>
References:  <200204291006.aa93819@salmon.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
David Malone wrote:
> > A shutdown guarantees that the data is transferred from the socket
> > buf to the TCP buf.  The real question here is how you get to the
> > state you claim is happening: the so isdisconnected() should stall
> > the calling process until the data has drained, if this is the case,
> > or it should never get called until the buffer is empty.
> 
> I think your fears about data being lost here may be unfounded.
> The description of soisdisconnected() says:
> 
>         ... soisdisconnected() is called when the connection to the
>         peer is totally severed.
> 
> This seems to mean that that either the connection has timed out
> or has been aborted. I think it should be safe to drop any data
> which is waiting to be sent if connection is actually severed.
> 
> I've included a list of the places where soisdisconnected is called
> from, and they all seem pretty final.

I think you are complaining about the default for the keepalive
socket option.  I think you will get the behaviour ytou desire
without hacking up the code, just by:

	sysctl -w net.inet.tcp.always_keepalive=0

PS: You still didn't answer the question; yes, it's called when the
connection is "totally severed".  But when is the connection ever
"totally severed"?

PPS: Ask yourself: how is it that it's *EVER* possible for the function
soisdisconnected() to be called without the socket buffer having been
emptied *FIRST*.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CCD2679.B5D5A709>