utils/examples: avoid busy waiting on wait for reconnect

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-04-13 10:26:28 +02:00
parent a8b33cefac
commit e219f1bb97
5 changed files with 38 additions and 13 deletions

View File

@@ -395,6 +395,7 @@ int main(int argc, char *argv[])
while (client.in_flight && !client.err_cnt && finished < 2) {
pfd[0].fd = iscsi_get_fd(client.iscsi);
pfd[0].events = iscsi_which_events(client.iscsi);
if (proc_alarm) {
if (iscsi_get_nops_in_flight(client.iscsi) > MAX_NOP_FAILURES) {
iscsi_reconnect(client.iscsi);
@@ -407,6 +408,11 @@ int main(int argc, char *argv[])
proc_alarm = 0;
}
if (!pfd[0].events) {
sleep(1);
continue;
}
if (poll(&pfd[0], 1, -1) < 0) {
continue;
}