aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
Diffstat (limited to 'swarm')
-rw-r--r--swarm/network/fetcher.go2
-rw-r--r--swarm/network/simulation/simulation.go2
-rw-r--r--swarm/network/stream/peer.go2
-rw-r--r--swarm/pot/doc.go4
-rw-r--r--swarm/storage/netstore.go4
5 files changed, 8 insertions, 6 deletions
diff --git a/swarm/network/fetcher.go b/swarm/network/fetcher.go
index 35e2f0132..413b40cb5 100644
--- a/swarm/network/fetcher.go
+++ b/swarm/network/fetcher.go
@@ -215,7 +215,7 @@ func (f *Fetcher) run(ctx context.Context, peers *sync.Map) {
var err error
sources, err = f.doRequest(ctx, gone, peers, sources)
if err != nil {
- log.Warn("unable to request", "request addr", f.addr, "err", err)
+ log.Info("unable to request", "request addr", f.addr, "err", err)
}
}
diff --git a/swarm/network/simulation/simulation.go b/swarm/network/simulation/simulation.go
index 096f7322c..2c7a18b09 100644
--- a/swarm/network/simulation/simulation.go
+++ b/swarm/network/simulation/simulation.go
@@ -112,7 +112,7 @@ type Result struct {
}
// Run calls the RunFunc function while taking care of
-// cancelation provided through the Context.
+// cancellation provided through the Context.
func (s *Simulation) Run(ctx context.Context, f RunFunc) (r Result) {
//if the option is set to run a HTTP server with the simulation,
//init the server and start it
diff --git a/swarm/network/stream/peer.go b/swarm/network/stream/peer.go
index 1466a7a9c..5fdaa7b87 100644
--- a/swarm/network/stream/peer.go
+++ b/swarm/network/stream/peer.go
@@ -165,7 +165,7 @@ func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error {
if err != nil {
return err
}
- // true only when quiting
+ // true only when quitting
if len(hashes) == 0 {
return nil
}
diff --git a/swarm/pot/doc.go b/swarm/pot/doc.go
index 4c0a03065..cb6faea57 100644
--- a/swarm/pot/doc.go
+++ b/swarm/pot/doc.go
@@ -27,11 +27,11 @@ OR distance over finite set of integers).
Methods take a comparison operator (pof, proximity order function) to compare two
value types. The default pof assumes Val to be or project to a byte slice using
-the reverse rank on the MSB first XOR logarithmic disctance.
+the reverse rank on the MSB first XOR logarithmic distance.
If the address space if limited, equality is defined as the maximum proximity order.
-The container offers applicative (funcional) style methods on PO trees:
+The container offers applicative (functional) style methods on PO trees:
* adding/removing en element
* swap (value based add/remove)
* merging two PO trees (union)
diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go
index de2d82d2b..80ac6f198 100644
--- a/swarm/storage/netstore.go
+++ b/swarm/storage/netstore.go
@@ -52,6 +52,8 @@ type NetStore struct {
closeC chan struct{}
}
+var fetcherTimeout = 2 * time.Minute // timeout to cancel the fetcher even if requests are coming in
+
// NewNetStore creates a new NetStore object using the given local store. newFetchFunc is a
// constructor function that can create a fetch function for a specific chunk address.
func NewNetStore(store SyncChunkStore, nnf NewNetFetcherFunc) (*NetStore, error) {
@@ -168,7 +170,7 @@ func (n *NetStore) getOrCreateFetcher(ref Address) *fetcher {
// no fetcher for the given address, we have to create a new one
key := hex.EncodeToString(ref)
// create the context during which fetching is kept alive
- ctx, cancel := context.WithCancel(context.Background())
+ ctx, cancel := context.WithTimeout(context.Background(), fetcherTimeout)
// destroy is called when all requests finish
destroy := func() {
// remove fetcher from fetchers