-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
Description
The current SendToChildrenInParallel is synchronous: it waits for each children to receive the message OR to return an error. Unfortunately some connections only return an error after a timeout. For the blscosi protocol, this timeout is too long for the protocol to work correctly.
So SendToChildrenInParallel should return immediately and still allow to be notified:
- when it's done
- eventual errors
@tharvik proposed the following code:
ret := make(chan error)
childsRets := make(chan error)
go func() {
for range p.Children() {
if err := <-childsRets; err != nil {
ret <- xerrors.Errorf("send to children: %v", err)
}
}
close(ret)
}()
for _, c := range p.Children() {
go func(tn *onet.TreeNode) {
childsRets <- p.SendTo(tn, msg)
}(c)
}
return ret
As this is a breaking change, one could add the following to SendToChildrenInParallel:
Deprecated: this is synchronous with eventual connection errors, so please use `SendToChildrenInBackground`.
Naming propositions (add yours):
SendToChildrenInBackground
Once this is merged, the calls to SendToChildrenInParallel should be replaced with this one. Also the hacky ones in the cothority/blscosi/protocol/sub_protocol.go and cothority/messaging/propagate.go.
Reactions are currently unavailable