Commit 3867e321 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet Committed by Brian Tiger Chow

add Peerstore to dht

parent fdccc21d
...@@ -36,6 +36,9 @@ type IpfsDHT struct { ...@@ -36,6 +36,9 @@ type IpfsDHT struct {
// Local peer (yourself) // Local peer (yourself)
self *peer.Peer self *peer.Peer
// Other peers
peerstore peer.Peerstore
// Local data // Local data
datastore ds.Datastore datastore ds.Datastore
dslock sync.Mutex dslock sync.Mutex
...@@ -53,12 +56,13 @@ type IpfsDHT struct { ...@@ -53,12 +56,13 @@ type IpfsDHT struct {
} }
// NewDHT creates a new DHT object with the given peer as the 'local' host // NewDHT creates a new DHT object with the given peer as the 'local' host
func NewDHT(p *peer.Peer, net inet.Network, sender inet.Sender, dstore ds.Datastore) *IpfsDHT { func NewDHT(p *peer.Peer, ps peer.Peerstore, net inet.Network, sender inet.Sender, dstore ds.Datastore) *IpfsDHT {
dht := new(IpfsDHT) dht := new(IpfsDHT)
dht.network = net dht.network = net
dht.sender = sender dht.sender = sender
dht.datastore = dstore dht.datastore = dstore
dht.self = p dht.self = p
dht.peerstore = ps
dht.providers = NewProviderManager(p.ID) dht.providers = NewProviderManager(p.ID)
dht.shutdown = make(chan struct{}) dht.shutdown = make(chan struct{})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment