@cryptotaxi247 / kubo / commits / 71ec4f91d

Drop -> CloseConnection

Juan Batiz-Benet committed Aug 30, 2014 at 00:00 UTC 71ec4f91dc68184cfad950e74883d217ce4c9749
3 files changed +5 -5
routing/dht/dht.go
+2 -2
@@ -521,7 +521,7 @@ func (dht *IpfsDHT) putLocal(key u.Key, value []byte) error {
521 func (dht *IpfsDHT) Update(p *peer.Peer) {
522 for _, route := range dht.routingTables {
523 removed := route.Update(p)
524 - // Only drop the connection if no tables refer to this peer
524 + // Only close the connection if no tables refer to this peer
525 if removed != nil {
526 found := false
527 for _, r := range dht.routingTables {
@@ -531,7 +531,7 @@ func (dht *IpfsDHT) Update(p *peer.Peer) {
531 }
532 }
533 if !found {
534 - dht.network.Drop(removed)
534 + dht.network.CloseConnection(removed)
535 }
536 }
537 }
swarm/interface.go
+1 -1
@@ -16,5 +16,5 @@ type Network interface {
16 GetErrChan() chan error
17 GetChannel(PBWrapper_MessageType) *Chan
18 Close()
19 - Drop(*peer.Peer) error
19 + CloseConnection(*peer.Peer) error
20 }
swarm/swarm.go
+2 -2
@@ -467,8 +467,8 @@ func (s *Swarm) ConnectNew(addr *ma.Multiaddr) (*peer.Peer, error) {
467 return npeer, err
468 }
469
470 -// Removes a given peer from the swarm and closes connections to it
471 -func (s *Swarm) Drop(p *peer.Peer) error {
470 +// CloseConnection removes a given peer from swarm + closes the connection
471 +func (s *Swarm) CloseConnection(p *peer.Peer) error {
472 u.DOut("Dropping peer: [%s]\n", p.ID.Pretty())
473 s.connsLock.RLock()
474 conn, found := s.conns[u.Key(p.ID)]