energostack / bisquitt

Bisquitt, a transparent MQTT-SN gateway
Eclipse Public License 2.0
19 stars 3 forks source link

client: Fix errors returned from API functions #27

Closed mprymek closed 1 year ago

mprymek commented 1 year ago

If an error appears inside any of the the Client.group goroutines, the failed goroutine returns a non-nil error and the whole Client.group is cancelled using Client.groupCtx. I.e. this condition is signalized by closed Client.groupCtx.Done() channel.

The Client's API functions should get the error using Client.group.Wait() call and return it to the caller. There's no point in returning context.Canceled because Client.group.Wait() must eventually return in such condition.