Commit 32810650 authored by Jeromy's avatar Jeromy
Browse files

keep routing logic out of NewStream on routedHost

parent 90fa9290
......@@ -100,14 +100,6 @@ func (rh *RoutedHost) SetStreamHandler(pid protocol.ID, handler inet.StreamHandl
rh.host.SetStreamHandler(pid, handler)
}
func (rh *RoutedHost) NewStream(pid protocol.ID, p peer.ID) (inet.Stream, error) {
if len(rh.Peerstore().Addrs(p)) < 1 {
ctx, _ := context.WithTimeout(context.TODO(), time.Second*30)
pi, err := rh.route.FindPeer(ctx, p)
if err != nil {
return nil, err
}
rh.Peerstore().AddAddrs(p, pi.Addrs, peer.TempAddrTTL)
}
return rh.host.NewStream(pid, p)
}
func (rh *RoutedHost) Close() error {
......
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