Skip to content

Commit

Permalink
Merge pull request #2860 from ipfs/feat/provide-storage
Browse files Browse the repository at this point in the history
Write providers to disk to avoid memory leaks
  • Loading branch information
whyrusleeping authored Jun 28, 2016
2 parents 3b2993d + d489f82 commit 5592144
Show file tree
Hide file tree
Showing 6 changed files with 523 additions and 229 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@
"hash": "QmQdnfvZQuhdT93LNc5bos52wAmdr3G2p6G8teLJMEN32P",
"name": "go-libp2p-peerstore",
"version": "1.1.2"
},
{
"author": "whyrusleeping",
"hash": "Qmb1DA2A9LS2wR4FFweB4uEDomFsdmnw1VLawLE1yQzudj",
"name": "base32",
"version": "0.0.0"
}
],
"gxVersion": "0.4.0",
Expand Down
7 changes: 4 additions & 3 deletions routing/dht/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
key "github.com/ipfs/go-ipfs/blocks/key"
routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
providers "github.com/ipfs/go-ipfs/routing/dht/providers"
kb "github.com/ipfs/go-ipfs/routing/kbucket"
record "github.com/ipfs/go-ipfs/routing/record"

Expand Down Expand Up @@ -48,7 +49,7 @@ type IpfsDHT struct {
datastore ds.Datastore // Local data

routingTable *kb.RoutingTable // Array of routing tables for differently distanced nodes
providers *ProviderManager
providers *providers.ProviderManager

birth time.Time // When this peer started up
diaglock sync.Mutex // lock to make diagnostics work better
Expand Down Expand Up @@ -84,8 +85,8 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Datastore) *IpfsDHT {
dht.ctx = ctx

h.SetStreamHandler(ProtocolDHT, dht.handleNewStream)
dht.providers = NewProviderManager(dht.ctx, dht.self)
dht.proc.AddChild(dht.providers.proc)
dht.providers = providers.NewProviderManager(dht.ctx, dht.self, dstore)
dht.proc.AddChild(dht.providers.Process())
goprocessctx.CloseAfterContext(dht.proc, ctx)

dht.routingTable = kb.NewRoutingTable(20, kb.ConvertPeerID(dht.self), time.Minute, dht.peerstore)
Expand Down
165 changes: 0 additions & 165 deletions routing/dht/providers.go

This file was deleted.

Loading

0 comments on commit 5592144

Please sign in to comment.