[mnet-devel] patch: enable download backoff
Arno Waschk
hamamatsu at gmx.de
Tue Feb 17 19:26:50 GMT 2004
this should be really innocent, and helpful no matter was is going on in
the next patch ;) Arno
On 17 Feb 2004 11:57:15 -0500, Zooko O'Whielacronx <zooko at zooko.com> wrote:
>
> This is a change to BlockWrangler to provide an optional "delay"
> argument to
> backoff stalled downloads.
>
> It almost certainly can't hurt, and it is required for the patch that is
> coming
> next. (Although of course you might not want to accept the patch that
> is coming
> next...)
>
>
> --- common/BlockWrangler.py 7 Dec 2003 17:35:50 -0000 1.94
> +++ common/BlockWrangler.py 17 Feb 2004 16:41:35 -0000
> @@ -282,7 +283,7 @@ class BlockWrangler(nummedobj.NummedObj)
>
> ### The following methods are for strategies to use.
> ### The following methods are for strategies to use. (Commands to
> take action.)
> - def look_for_blocks_on_peer(self, peerId, blockIds):
> + def look_for_blocks_on_peer(self, peerId, blockIds, nextdelay=0):
> """
> @precondition: blockIds must be a non-empty sequence.:
> (type(blockIds) in (types.TupleType, types.ListType,)) and
> (len(blockIds) > 0): "blockIds: %s :: %s" % tuple(map(humanreadable.hr,
> (blockIds, type(blockIds),)))
> """
> @@ -291,7 +292,7 @@ class BlockWrangler(nummedobj.NummedObj)
>
> assert self.data._assert_consistency()
>
> - def _handle_look_for_blocks_result(widget, outcome,
> failure_reason=None, queryblockIds=blockIds, peerId=peerId, self=self):
> + def _handle_look_for_blocks_result(widget, outcome,
> failure_reason=None, queryblockIds=blockIds, peerId=peerId, self=self,
> nextdelay=nextdelay):
> assert self.data._assert_consistency()
> if not failure_reason:
> assert type(outcome) in (types.ListType,
> types.TupleType,), "outcome: %s :: %s" % tuple(map(humanreadable.hr,
> (outcome, type(outcome),)))
> @@ -303,9 +304,9 @@ class BlockWrangler(nummedobj.NummedObj)
> self.data.remove_Ids_of_located_blocks(peerId,
> blockIds=queryblockIds)
>
> # Tell the strategy to wake up -- there are new results to
> consider! (Even failure is a new result to consider.)
> - self.strategy.schedule_event()
> + self.strategy.schedule_event(delay=nextdelay)
>
> def _handle_timely_look_for_blocks_result(widget, outcome,
> failure_reason=None,
> _handle_look_for_blocks_result=_handle_look_for_blocks_result,
> peerId=peerId, self=self):
> """
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> mnet-devel mailing list
> mnet-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mnet-devel
>
--
http://www.arnowaschk.de
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
mnet-devel mailing list
mnet-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mnet-devel
More information about the Mnet-devel
mailing list