aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/afm-main-plugin
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-02-09 17:43:41 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-02-09 17:43:41 +0100
commit0d81cd0332e72d6c2ed91dc58184229a92b28196 (patch)
treed1cf949f17f103bf2798a0571f5761a9407b7401 /plugins/afm-main-plugin
parentcdd17e5b4a9f99361d4809317e62a585ac55521a (diff)
afm-main-plugin: utils-jbus: fix bug that blocked
Change-Id: Id31e2c93a1a128d768f9a55fdc739b0067b85121 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'plugins/afm-main-plugin')
-rw-r--r--plugins/afm-main-plugin/utils-jbus.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/afm-main-plugin/utils-jbus.c b/plugins/afm-main-plugin/utils-jbus.c
index 1f85a4cd..67e3ce4c 100644
--- a/plugins/afm-main-plugin/utils-jbus.c
+++ b/plugins/afm-main-plugin/utils-jbus.c
@@ -669,6 +669,7 @@ int jbus_dispatch_multiple(struct jbus **jbuses, int njbuses, int maxcount)
for (i = r = 0 ; i < njbuses && r < maxcount ; i++) {
dbus_connection_read_write(jbuses[i]->connection, 0);
+ sts = dbus_connection_get_dispatch_status(jbuses[i]->connection);
while(sts == DBUS_DISPATCH_DATA_REMAINS && r < maxcount) {
sts = dbus_connection_dispatch(jbuses[i]->connection);
r++;
@@ -690,10 +691,17 @@ int jbus_read_write_dispatch_multiple(struct jbus **jbuses, int njbuses, int tom
assert(fds != NULL);
r = jbus_dispatch_multiple(jbuses, njbuses, maxcount);
+ if (r)
+ return r;
n = jbus_fill_pollfds(jbuses, njbuses, fds);
- s = poll(fds, n, toms);
- if (s < 0)
- return r ? r : s;
+ for(;;) {
+ s = poll(fds, n, toms);
+ if (s >= 0)
+ break;
+ if (errno != EINTR)
+ return r ? r : s;
+ toms = 0;
+ }
n = jbus_dispatch_pollfds(jbuses, njbuses, fds, maxcount - r);
return n >= 0 ? r + n : r ? r : n;
}