On Mon, 01 May 2000, Paul Kappler wrote: > The Mac version still does not work with non-local inserts with files of any > significant size. The reason is as Oskar describes. The problem is only > with sending files during inserts as far I can tell. > > Maybe your fix could only be applied to the Mac version. I don't like that > however. I would prefer the code not use SO_Timeout at all, it just seems > like bad style to me. Is that what your solution involves?
Well, so would I if there was an alternative. If you remember I was screaming and tearing my hair off for weeks before I implemented it this way. If someone has another way I would love to hear it, but here is what is out: - Doing a read() without timeout and then just forcing the connection closed on a close call. This doesn't work because it should only close between messages. Besides, it is even uglier and doesn't always seem to work. - Reading available() off the stream, and if it is zero, sleep and wait for data to come in. This doesn't work because available() doesn't warn you if the connection closes suddenly, it keeps giving 0, and there is no other way of checking is a socket is dead except to attempt a read. - using a read without timeout and calling interrupt() on the method. The Sun Gods decided that read() and accept() should not be interrupt-able although they lock. The class I wrote is a FilterInputStream class that starts a thread that reads an Inputstream and puts a byte in a buffer when it is read. When a thread does read() on this stream, and there is nothing in the buffer, it does wait() on the stream, until the reading thread reads something, puts it in the buffer, and does notify(). Wait is interrupt-able so both interrupt and setting a timeout time will work on this stream. But it is a major unnecessary step of an extra thread and an extra copy of all the data. > > Paul > > > From: Oskar Sandberg <md98-osa at nada.kth.se> > > Reply-To: freenet-dev at lists.sourceforge.net > > Date: Mon, 1 May 2000 19:25:33 +0200 > > To: freenet-dev at lists.sourceforge.net > > Subject: Re: [Freenet-dev] Re: Version 0.2 for Mac? > > > > > > I think there is a problem with a bug in the mac JVM where the socket reads > > would not timeout correctly. I have written a class to handle this, but it > > involves and extra thread per connection, so I would rather not use it if we > > didn't have to. > > > > On Mon, 01 May 2000, Ian Clarke wrote: > >> Thomas Black wrote: > >>> > >>> Dear Ian, > >>> > >>> There does not appear to be a 0.2 version for the Macintosh. Has Mac > >>> development been dropped, or is it merely lagging? > >>> > >>> Tom Black (tblack at sensci.com) > >> > >> It is lagging, I don't have the ability to create a mac distro (unless > >> someone can find some Unix tools for doing it and adds the capability to > >> the makedist.sh script) so I need to wait for someone to volunteer to > >> create one :-( > >> > >> Ian. > >> > >> _______________________________________________ > >> Freenet-dev mailing list > >> Freenet-dev at lists.sourceforge.net > >> http://lists.sourceforge.net/mailman/listinfo/freenet-dev > > -- > > > > Oskar Sandberg > > > > md98-osa at nada.kth.se > > > > #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj > > $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1 > > lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/) > > > > _______________________________________________ > > 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 -- Oskar Sandberg md98-osa at nada.kth.se #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1 lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/) _______________________________________________ Freenet-dev mailing list Freenet-dev at lists.sourceforge.net http://lists.sourceforge.net/mailman/listinfo/freenet-dev
