Remove unused kademlia.Disconnect method (#1178)
This commit is contained in:
parent
d5346982c2
commit
97714d150f
@ -19,7 +19,6 @@ type DHT interface {
|
||||
Bootstrap(ctx context.Context) error
|
||||
Ping(ctx context.Context, node pb.Node) (pb.Node, error)
|
||||
FindNode(ctx context.Context, ID storj.NodeID) (pb.Node, error)
|
||||
Disconnect() error
|
||||
Seen() []*pb.Node
|
||||
}
|
||||
|
||||
|
@ -76,18 +76,6 @@ func (k *Kademlia) Close() error {
|
||||
return dialerErr
|
||||
}
|
||||
|
||||
// Disconnect safely closes connections to the Kademlia network
|
||||
func (k *Kademlia) Disconnect() error {
|
||||
dialerErr := k.dialer.Close()
|
||||
k.lookups.Close()
|
||||
k.lookups.Wait()
|
||||
|
||||
return errs.Combine(
|
||||
dialerErr,
|
||||
k.routingTable.Close(),
|
||||
)
|
||||
}
|
||||
|
||||
// FindNear returns all nodes from a starting node up to a maximum limit
|
||||
// stored in the local routing table limiting the result by the specified restrictions
|
||||
func (k *Kademlia) FindNear(ctx context.Context, start storj.NodeID, limit int, restrictions ...pb.Restriction) ([]*pb.Node, error) {
|
||||
|
@ -78,7 +78,7 @@ func TestNewKademlia(t *testing.T) {
|
||||
assert.Equal(t, kad.bootstrapNodes, v.bn)
|
||||
assert.NotNil(t, kad.dialer)
|
||||
assert.NotNil(t, kad.routingTable)
|
||||
assert.NoError(t, kad.Disconnect())
|
||||
assert.NoError(t, kad.Close())
|
||||
}
|
||||
|
||||
}
|
||||
@ -109,9 +109,7 @@ func TestPeerDiscovery(t *testing.T) {
|
||||
assert.Equal(t, rt.Local().Metadata.Email, "foo@bar.com")
|
||||
assert.Equal(t, rt.Local().Metadata.Wallet, "OperatorWallet")
|
||||
|
||||
defer func() {
|
||||
assert.NoError(t, k.Disconnect())
|
||||
}()
|
||||
defer ctx.Check(k.Close)
|
||||
|
||||
cases := []struct {
|
||||
target storj.NodeID
|
||||
@ -190,7 +188,7 @@ func testNode(t *testing.T, bn []pb.Node) (*Kademlia, *grpc.Server, func()) {
|
||||
|
||||
return k, grpcServer, func() {
|
||||
defer cleanup()
|
||||
assert.NoError(t, k.Disconnect())
|
||||
assert.NoError(t, k.Close())
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,9 +250,7 @@ func TestFindNear(t *testing.T) {
|
||||
defer cleanup()
|
||||
k, err := newKademlia(zaptest.NewLogger(t), pb.NodeType_STORAGE, []pb.Node{{Id: fid2.ID, Address: &pb.NodeAddress{Address: lis.Addr().String()}}}, lis.Addr().String(), nil, fid, dir, defaultAlpha)
|
||||
assert.NoError(t, err)
|
||||
defer func() {
|
||||
assert.NoError(t, k.Disconnect())
|
||||
}()
|
||||
defer ctx.Check(k.Close)
|
||||
|
||||
// add nodes
|
||||
ids := storj.NodeIDList{nodeIDA, nodeIDB, nodeIDC, nodeIDD}
|
||||
|
Loading…
Reference in New Issue
Block a user