Commit 7fabe392 authored by vyzo's avatar vyzo
Browse files

parallel identify push

parent 477c19aa
...@@ -149,15 +149,17 @@ func (ids *IDService) pushHandler(s inet.Stream) { ...@@ -149,15 +149,17 @@ func (ids *IDService) pushHandler(s inet.Stream) {
func (ids *IDService) Push() { func (ids *IDService) Push() {
for _, p := range ids.Host.Network().Peers() { for _, p := range ids.Host.Network().Peers() {
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) go func(p peer.ID) {
s, err := ids.Host.NewStream(ctx, p, IDPush) ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
cancel() defer cancel()
if err != nil { s, err := ids.Host.NewStream(ctx, p, IDPush)
log.Debugf("error opening push stream: %s", err.Error()) if err != nil {
continue log.Debugf("error opening push stream: %s", err.Error())
} return
}
ids.requestHandler(s) ids.requestHandler(s)
}(p)
} }
} }
......
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