1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 17:03:58 +08:00

Drop -> CloseConnection

This commit is contained in:
Juan Batiz-Benet
2014-08-30 00:00:52 -07:00
committed by Brian Tiger Chow
parent d934806eaf
commit 71ec4f91dc
3 changed files with 5 additions and 5 deletions

View File

@ -521,7 +521,7 @@ func (dht *IpfsDHT) putLocal(key u.Key, value []byte) error {
func (dht *IpfsDHT) Update(p *peer.Peer) {
for _, route := range dht.routingTables {
removed := route.Update(p)
// Only drop the connection if no tables refer to this peer
// Only close the connection if no tables refer to this peer
if removed != nil {
found := false
for _, r := range dht.routingTables {
@ -531,7 +531,7 @@ func (dht *IpfsDHT) Update(p *peer.Peer) {
}
}
if !found {
dht.network.Drop(removed)
dht.network.CloseConnection(removed)
}
}
}

View File

@ -16,5 +16,5 @@ type Network interface {
GetErrChan() chan error
GetChannel(PBWrapper_MessageType) *Chan
Close()
Drop(*peer.Peer) error
CloseConnection(*peer.Peer) error
}

View File

@ -467,8 +467,8 @@ func (s *Swarm) ConnectNew(addr *ma.Multiaddr) (*peer.Peer, error) {
return npeer, err
}
// Removes a given peer from the swarm and closes connections to it
func (s *Swarm) Drop(p *peer.Peer) error {
// CloseConnection removes a given peer from swarm + closes the connection
func (s *Swarm) CloseConnection(p *peer.Peer) error {
u.DOut("Dropping peer: [%s]\n", p.ID.Pretty())
s.connsLock.RLock()
conn, found := s.conns[u.Key(p.ID)]