diff --git a/lib/socket.c b/lib/socket.c index 7abd9cd..0646532 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -402,6 +402,11 @@ iscsi_which_events(struct iscsi_context *iscsi) { int events = iscsi->is_connected ? POLLIN : POLLOUT; + if (iscsi->pending_reconnect && iscsi->is_reconnecting && + time(NULL) < iscsi->next_reconnect) { + return 0; + } + if (iscsi->outqueue_current != NULL || (iscsi->outqueue != NULL && !iscsi->is_corked && (iscsi_serial32_compare(iscsi->outqueue->cmdsn, iscsi->maxcmdsn) <= 0 || @@ -788,7 +793,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents) } if (iscsi->pending_reconnect) { - if (time(NULL) > iscsi->next_reconnect) { + if (time(NULL) >= iscsi->next_reconnect) { return iscsi_reconnect(iscsi); } else { if (iscsi->is_reconnecting) {