Commit e5f7fdb7 authored by Petar Radovic's avatar Petar Radovic Committed by GitHub

Remove invalid disconnected call (#553)

* disconnected calls fixe

* remove unused disconnect
parent 6d56fc59
...@@ -429,7 +429,6 @@ func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz. ...@@ -429,7 +429,6 @@ func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz.
func (s *Service) Disconnect(overlay swarm.Address) error { func (s *Service) Disconnect(overlay swarm.Address) error {
peerID, found := s.peers.peerID(overlay) peerID, found := s.peers.peerID(overlay)
if !found { if !found {
s.peers.disconnect(overlay)
return p2p.ErrPeerNotFound return p2p.ErrPeerNotFound
} }
...@@ -456,7 +455,6 @@ func (s *Service) AddNotifier(n topology.Notifier) { ...@@ -456,7 +455,6 @@ func (s *Service) AddNotifier(n topology.Notifier) {
func (s *Service) NewStream(ctx context.Context, overlay swarm.Address, headers p2p.Headers, protocolName, protocolVersion, streamName string) (p2p.Stream, error) { func (s *Service) NewStream(ctx context.Context, overlay swarm.Address, headers p2p.Headers, protocolName, protocolVersion, streamName string) (p2p.Stream, error) {
peerID, found := s.peers.peerID(overlay) peerID, found := s.peers.peerID(overlay)
if !found { if !found {
s.peers.disconnect(overlay)
return nil, p2p.ErrPeerNotFound return nil, p2p.ErrPeerNotFound
} }
......
...@@ -183,9 +183,3 @@ func (r *peerRegistry) remove(peerID libp2ppeer.ID) { ...@@ -183,9 +183,3 @@ func (r *peerRegistry) remove(peerID libp2ppeer.ID) {
func (r *peerRegistry) addDisconnecter(d topology.Disconnecter) { func (r *peerRegistry) addDisconnecter(d topology.Disconnecter) {
r.disconnecters = append(r.disconnecters, d) r.disconnecters = append(r.disconnecters, d)
} }
func (r *peerRegistry) disconnect(address swarm.Address) {
for _, d := range r.disconnecters {
d.Disconnected(address)
}
}
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