We set it to 10 secs (as we are only communicating with the kernel,
it seems we should be able to bail out sooner than sd-bus, which
uses 25).
When passing timout 0, the default is used, use this in link-config.
+
+#define RTNL_DEFAULT_TIMEOUT ((usec_t) (10 * USEC_PER_SEC))
+
int message_get_errno(sd_rtnl_message *m);
int message_get_serial(sd_rtnl_message *m);
int message_seal(sd_rtnl *nl, sd_rtnl_message *m);
int message_get_errno(sd_rtnl_message *m);
int message_get_serial(sd_rtnl_message *m);
int message_seal(sd_rtnl *nl, sd_rtnl_message *m);
p[0].fd = nl->fd;
p[0].events = POLLOUT;
p[0].fd = nl->fd;
p[0].events = POLLOUT;
- timeout = now(CLOCK_MONOTONIC) + usec;
+ if (usec == (uint64_t) -1)
+ timeout = 0;
+ else if (usec == 0)
+ timeout = now(CLOCK_MONOTONIC) + RTNL_DEFAULT_TIMEOUT;
+ else
+ timeout = now(CLOCK_MONOTONIC) + usec;
- if (usec != (uint64_t) -1) {
usec_t n;
n = now(CLOCK_MONOTONIC);
usec_t n;
n = now(CLOCK_MONOTONIC);
timespec_store(&left, timeout - n);
}
timespec_store(&left, timeout - n);
}
- r = ppoll(p, 1, usec == (uint64_t) -1 ? NULL : &left, NULL);
+ r = ppoll(p, 1, timeout ? &left : NULL, NULL);
for (;;) {
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *reply = NULL;
for (;;) {
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *reply = NULL;
- if (usec != (uint64_t) -1) {
usec_t n;
n = now(CLOCK_MONOTONIC);
usec_t n;
n = now(CLOCK_MONOTONIC);
timespec_store(&left, timeout - n);
}
timespec_store(&left, timeout - n);
}
- r = ppoll(p, 1, usec == (uint64_t) -1 ? NULL : &left, NULL);
+ r = ppoll(p, 1, timeout ? &left : NULL, NULL);
- r = sd_rtnl_send_with_reply_and_block(rtnl, message, 5 * USEC_PER_SEC, NULL);
+ r = sd_rtnl_send_with_reply_and_block(rtnl, message, 0, NULL);