Freeloader uses the ByteCounterInputStream concept to do this.  It is not a
perfect solution but it works.  You can watch the bytes counted until the
whole file has been read.  At this point you know it's done.  This happens
in both the ProgressBar and insert file button in the MainFrame.

Maybe GUI's need a slight different ConnectionHandler model then the server
is using, or maybe we need to change the current model.  Maybe a synchronous
model with progress events would be a better solution.  I know I don't like
having having all of the critical sections all over the code for handling
conduits.

I struggled with looking for a better way as well, I did not find one in the
current model.  Maybe after we all see your code a better way will better
way will become clear.  This project is in constant evolution.



Paul

From: "Jebu Ittiachen" <[email protected]>
Reply-To: freenet-dev at lists.sourceforge.net
Date: Mon, 17 Apr 2000 21:22:32 -0500
To: <freenet-dev at lists.sourceforge.net>
Subject: [Freenet-dev] Signalling end of data insertion.....

Hi,
   I was looking around the code for finding some place to trigger the GUI a
signal that the insert request has been completed, like in the case of a
data request where a conduit is started off by the SimpleRequestClient in
case of FGUI and gets calledback. However in the case of a message which has
a payload like the Insert message the ConnectionHandlers sendMessage() has
something of this sort

<code-snip_from_ConnectionHandler.java>
    InputStream data = raw.getTrailing();
    if (data != null) {
 ConnectionCB ccb;
 if (!raw.isKeepAlive())
     ccb = new ConnectionCB();
 else
     ccb = null;
 (new Conduit(data, c.out)).asyncFeed(ccb, null, raw.trailingFieldLength());
    } else if (!raw.isKeepAlive()) {
 this.close();
</code-snip_from_ConnectionHandler.java>

Should the invoking agent have more control over the way this conduit
functions? shud the invoking agent have some way of being called back by the
coduit rather than having the signal of a end of input come from inside the
counter class? 
Situations like a network fault where the connection breaks off between an
insert or request the Conduit calls the interrupted callback and in case of
a insert the invoker gets no signal of this. However in case of the key
request since the async feed is started by the invoker the callbacks are
handy.......
any lights on this???

jebu




-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20000418/184095bf/attachment.html>

Reply via email to