mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-04 07:48:00 +08:00
remove start
This commit is contained in:
parent
7a785ded74
commit
700b6ab99f
@ -82,7 +82,7 @@ func (m *Muxer) handleIncomingMessages(ctx context.Context) {
|
||||
|
||||
for {
|
||||
if m == nil {
|
||||
panic("nix muxer")
|
||||
panic("nil muxer")
|
||||
}
|
||||
|
||||
select {
|
||||
|
||||
@ -45,9 +45,6 @@ type IpfsDHT struct {
|
||||
|
||||
providers *ProviderManager
|
||||
|
||||
// Signal to shutdown dht
|
||||
shutdown chan struct{}
|
||||
|
||||
// When this peer started up
|
||||
birth time.Time
|
||||
|
||||
@ -65,7 +62,6 @@ func NewDHT(p *peer.Peer, ps peer.Peerstore, net inet.Network, sender inet.Sende
|
||||
dht.peerstore = ps
|
||||
|
||||
dht.providers = NewProviderManager(p.ID)
|
||||
dht.shutdown = make(chan struct{})
|
||||
|
||||
dht.routingTables = make([]*kb.RoutingTable, 3)
|
||||
dht.routingTables[0] = kb.NewRoutingTable(20, kb.ConvertPeerID(p.ID), time.Millisecond*30)
|
||||
@ -75,11 +71,6 @@ func NewDHT(p *peer.Peer, ps peer.Peerstore, net inet.Network, sender inet.Sende
|
||||
return dht
|
||||
}
|
||||
|
||||
// Start up background goroutines needed by the DHT
|
||||
func (dht *IpfsDHT) Start() {
|
||||
panic("the service is already started. rmv this method")
|
||||
}
|
||||
|
||||
// Connect to a new peer at the given address, ping and add to the routing table
|
||||
func (dht *IpfsDHT) Connect(addr *ma.Multiaddr) (*peer.Peer, error) {
|
||||
maddrstr, _ := addr.String()
|
||||
|
||||
@ -41,7 +41,6 @@ func setupDHT(t *testing.T, p *peer.Peer) *IpfsDHT {
|
||||
|
||||
d := NewDHT(p, peerstore, net, dhts, ds.NewMapDatastore())
|
||||
dhts.Handler = d
|
||||
d.Start()
|
||||
return d
|
||||
}
|
||||
|
||||
@ -116,8 +115,6 @@ func TestPing(t *testing.T) {
|
||||
dhtA := setupDHT(t, peerA)
|
||||
dhtB := setupDHT(t, peerB)
|
||||
|
||||
dhtA.Start()
|
||||
dhtB.Start()
|
||||
defer dhtA.Halt()
|
||||
defer dhtB.Halt()
|
||||
|
||||
@ -150,8 +147,6 @@ func TestValueGetSet(t *testing.T) {
|
||||
dhtA := setupDHT(t, peerA)
|
||||
dhtB := setupDHT(t, peerB)
|
||||
|
||||
dhtA.Start()
|
||||
dhtB.Start()
|
||||
defer dhtA.Halt()
|
||||
defer dhtB.Halt()
|
||||
|
||||
|
||||
@ -180,8 +180,6 @@ func (dht *IpfsDHT) handleAddProvider(p *peer.Peer, pmes *Message) (*Message, er
|
||||
// Halt stops all communications from this peer and shut down
|
||||
// TODO -- remove this in favor of context
|
||||
func (dht *IpfsDHT) Halt() {
|
||||
dht.shutdown <- struct{}{}
|
||||
dht.network.Close()
|
||||
dht.providers.Halt()
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user