Yes, I have said this a lot of times.
in.available() returns 0 on two conditions, there is nothing to read
because the other node has not sent a message, and there is nothing
to read because the stream has ended. This is very annoying. Someone
tell me a good way (short of reading the data, which I can figure out
for myself, but which a) eats the data we want in the message b)
locks) to differentiate between the two and I will be a happy man.
Oskar Sandberg - mail/finger md98-osa at nada.kth.se
-
Crypto is a human right
On Wed, 12 Apr 2000, Scott G. Miller wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Is it just me, or are the connections within Freenet never dying, and thus
> neither are the threads. I placed this test code in
> ConnectionHandler.java:
>
> while (!closed && c.in.available() == 0) {
> try {
> Thread.sleep(50);
> System.err.print("tick ");
> } catch (InterruptedException e) {
> }
> }
>
> Then had the following transaction:
>
> [01:56:42] scgmille at obsidian:~ $ telnet localhost 19114
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> ^]
> telnet> quit
> Connection closed.
>
> Meanwhile, on the server...
> obsidian:/usr/local/encap/freenet# bin/freenet_server
> Starting Freenet server
> .freenet/store_19114
> [1,0]
> tick tick tick tick tick tick tick tick tick tick tick tick tick tick tick
> tick tick tick tick tick tick tick tick tick tick tick tick tick tick tick
> tick tick tick tick tick tick tick tick tick tick tick tick tick tick tick
> tick tick tick tick tick tick tick tick tick tick tick tick tick tick tick
> tick tick tick tick tick tick tick tick tick tick tick tick tick tick tick
> tick tick
>
> ... etc
>
> Nothing shows up in the log saying the connection has died.
>
> netstat shows:
> Active Internet connections (w/o servers)
> Proto Recv-Q Send-Q Local Address Foreign Address State
>
> tcp 1 0 localhost:19114 localhost:4375 CLOSE_WAIT
>
> The recv-q appears to be non-empty, and yet the loop *must* be saying
> c.in.available()==0, so why can't we read that last byte and close the
> socket? Or how can we better know when the connection is lost and clean
> up?
>
> Scott
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.1 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE49B6zpXyM95IyRhURAvdeAJ0Sy8y00+KXleulqL45bBj5oBuBIACePWHH
> w/1f1Qhp0/Reg9plQs3C07Q=
> =kLlf
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Freenet-dev mailing list
> Freenet-dev at lists.sourceforge.net
> http://lists.sourceforge.net/mailman/listinfo/freenet-dev
>
_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev