summaryrefslogtreecommitdiffstats
path: root/plugins/afm-main-plugin/utils-jbus.c
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-02-17 14:41:07 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-02-17 14:41:07 +0100
commit3da6e9fad4c6788098cf425369fb3d7860cb824f (patch)
tree95751052d331a35162c242a4c2d2f177a9b7ada0 /plugins/afm-main-plugin/utils-jbus.c
parent6d0846d769256e74a3f403fc0e5965e2d227b324 (diff)
parentfcfb3c0951b6e2e06e7bf282e867576d8abb00c4 (diff)
Merge origin/master
Diffstat (limited to 'plugins/afm-main-plugin/utils-jbus.c')
-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;
}