Re: socket close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/5/07, skaller <skaller@xxxxxxxxxxxxxxxxxxxxx> wrote:
On Wed, 2007-07-04 at 14:27 -0400, Charlie Brady wrote:
> On Thu, 5 Jul 2007, skaller wrote:
>
> > What you seem to be saying is that sockets are fundamentally
> > screwed ...
>
> I don't think you are the first to suggest that:
>
> http://cr.yp.to/tcpip/twofd.html

Sure, but the writer is complaining about needing 'shutdown'.
I can't get it to work even with 'shutdown'.

So it looks like the Linux kernel is bugged, it's sending
RST too early?

John, what you wrote fixes my problems on linux, it almost is a
lingering close. You needed the shutdown, the sleep and to CONTINUE
reading the data, not just one byte.

Also, I would change the shutdown to 1 (write only) and the sleep to 2 like
in the apache code.

     Faio_posix::shutdown(s,2); // render socket unusable?
     Faio::sleep (Faio::sys_clock,5.0);
     var len = 1; var eof = false; var buf = C_hack::malloc(1);
     Faio_posix::async_read(s, &len, buf, &eof);
     fprint (cerr,q"STREAM:socket $s, eof=$eof\n");
     Faio_posix::shutdown(s,0);
     Faio_posix::close s;

not sure how to write it properly, we don't really have a
"read for n seconds" primitive.

Anyway, I also don't think this should be part of the general socket
close... it's a protocol problem.

It's nasty having all fthreads blocking often uselessly for n seconds
in close, so we could have a separate lingerer thread that handles all
the sockets that want to be lingeringly closed.

What say ye?

RF
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux