When performing this "promise" pattern, it is important to
provide a
channel with space for one value. Otherwise the sender may
block forever
in the case of a receiver that decides to abandon the
request. A subtle
detail, but one that is important for avoiding
leaked goroutines.
cc @whyrusleeping @jbenet
License: MIT
Signed-off-by: Brian Tiger Chow
<brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit makes GetProviders (sync) respect the request context. It
also amends all of GetProviders' callsites to pass a context in. This
meant changing the signature of the dht's handlerfunc.
I think I'll start referring to the request context as Vito Corleone.
cc @whyrusleeping @jbenet
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
the important change here is that within FindProvidersAsync, the channel
is closed using a `defer`. This ensures the channel is always closed,
regardless of the path taken to exit.
+ misc cleanup
cc @whyrusleeping @jbenet
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
It's better to have one mechanism for determining whether we're offline
and to improve the SnR of this mechanism over time. We presently have
too many arbitrary heuristics for determining whether we're running in
offline mode. TRTTD is to use polymorphism to eliminate these
conditional checks. (instantiate the node with offline versions of
routing, network, etc.) It'll clean up the core constructor, make it
easier to create ephemeral nodes, and eliminate a class of errors.
@whyrusleeping @jbenet
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@whyrusleeping @jbenet
Putting the block generator in a util dir until blocks.
Can't put it in util/testutil because the util/testutil/dag-generator
imports blockservice and blockservice uses the generator.
Tough problem. This'll do for now.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
vendor forked pubsub to get SubOnceEach
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>