Brandon wrote:

> Yuck. I just want a function which I can call which will return to me an
> item or throw an exception. Just like in the good old days when Travis was
> using a dictionary to simulate Freenet.

This *will* be possible - there will be a function emulating the old
behaviour.

> I don't see why you'd want to make requests non-blocking. I'm using the
> blocking request right now and have a perfectly nice NNTP gateway server
> which never waits for requests. It updates its cache of messages in the
> background through the beauty of launching a new thread for each request.

I built one too, using asyncore (non-blocking IO) - I had a fully working
NNTP server using Freenet as a backend.  The reason it used asyncore was
that I got the NNTP server code from Sam Rushing. So I don't want to support
blocking IO only - I want to support both.

Is your server available anywhere where I can look at it?


Request / Insert objects will use threading.Event objects
(http://www.python.org/doc/current/lib/event-objects.html).  Which means:

1. You can check, in a non-blocking fashion, if the request is finished.
2. You can block until the request is finished.

You can ignore option 1 if you want to, but it's available if anyone wants
too.

So, a request for a KSK would look like this (using the current code):

=======================================================================

# Start the request
r = Request(KSK("/my/doc"), htl=20)

# Check if we finished - perhaps the connection to the server died?
if r.finished.isSet():
    print "That was fast!"
else:
    # Block till the request is over
    r.finished.wait()

=======================================================================

_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev

Reply via email to