cli: register event handler first, then do lookup
authorAlexandru Ardelean <aardelean@riverbed.com>
Thu, 5 May 2016 11:03:30 +0000 (14:03 +0300)
committerFelix Fietkau <nbd@nbd.name>
Wed, 12 Oct 2016 18:00:35 +0000 (20:00 +0200)
commit312448a5b147c221836827a7a641e76a4514db44
treee168eb7db0958f9440f3587cd2668478d2fe7511
parentba45b27f8c1c4d56ebff7c584a471cdbce232ec8
cli: register event handler first, then do lookup

We seem to be getting timeout for ubus wait_for calls
every now and then.

And it's not reliably reproducible.
Looking at the code the only thing that would look like
a potetntial reason, is that between the ubus_lookup() and
ubus_register_event_handler() calls, there's a very narrow
window where the event would get sent out and we would not
get it, thus having to timeout.

It doesn't look like registering the event handler first
is a big problem for the whole wait_check_object() logic.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
cli.c