From a8b33cefaceeb3f76743c83ebdd789a37b934845 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 13 Apr 2015 10:13:36 +0200 Subject: [PATCH] drop iscsi->is_reconnecting iscsi->is_reconnecting != 0 is equal to iscsi->old_iscsi != NULL. Signed-off-by: Peter Lieven --- include/iscsi-private.h | 1 - lib/connect.c | 6 +----- lib/socket.c | 6 +++--- lib/sync.c | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 66c4b07..c993e11 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -111,7 +111,6 @@ struct iscsi_context { int secneg_phase; int login_attempts; int is_loggedin; - int is_reconnecting; int bind_interfaces_cnt; int nops_in_flight; diff --git a/lib/connect.c b/lib/connect.c index 6e19ea2..2c485e3 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -344,7 +344,6 @@ static void iscsi_reconnect_cb(struct iscsi_context *iscsi _U_, int status, ISCSI_LOG(iscsi, 2, "reconnect was successful"); iscsi->pending_reconnect = 0; - iscsi->is_reconnecting = 0; } int iscsi_reconnect(struct iscsi_context *old_iscsi) @@ -366,7 +365,7 @@ int iscsi_reconnect(struct iscsi_context *old_iscsi) return 0; } - if (old_iscsi->is_reconnecting && !old_iscsi->pending_reconnect) { + if (old_iscsi->old_iscsi && !old_iscsi->pending_reconnect) { return 0; } @@ -389,9 +388,6 @@ int iscsi_reconnect(struct iscsi_context *old_iscsi) ISCSI_LOG(old_iscsi, 2, "reconnect initiated"); - old_iscsi->is_reconnecting = 1; - iscsi->is_reconnecting = 1; - iscsi_set_targetname(iscsi, old_iscsi->target_name); iscsi_set_header_digest(iscsi, old_iscsi->want_header_digest); diff --git a/lib/socket.c b/lib/socket.c index 0646532..f26cb6a 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -402,7 +402,7 @@ iscsi_which_events(struct iscsi_context *iscsi) { int events = iscsi->is_connected ? POLLIN : POLLOUT; - if (iscsi->pending_reconnect && iscsi->is_reconnecting && + if (iscsi->pending_reconnect && iscsi->old_iscsi && time(NULL) < iscsi->next_reconnect) { return 0; } @@ -779,7 +779,7 @@ iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi) return 0; } } - if (iscsi->is_reconnecting) { + if (iscsi->old_iscsi) { return 0; } return -1; @@ -796,7 +796,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents) if (time(NULL) >= iscsi->next_reconnect) { return iscsi_reconnect(iscsi); } else { - if (iscsi->is_reconnecting) { + if (iscsi->old_iscsi) { return 0; } } diff --git a/lib/sync.c b/lib/sync.c index d9f929c..3b42208 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -172,7 +172,7 @@ reconnect_event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state { struct pollfd pfd; int ret; - while (iscsi->is_reconnecting) { + while (iscsi->old_iscsi) { pfd.fd = iscsi_get_fd(iscsi); pfd.events = iscsi_which_events(iscsi);