RECONNECT allow a consecutive reconnect only every 5 seconds
In case there is an error condition e.g. out of memory. We are heavily disconnecting and reconnecting without any limit. This patch adds a 5 seconds period that has to go by between 2 reconnects.
This commit is contained in:
@@ -220,6 +220,10 @@ int iscsi_reconnect(struct iscsi_context *old_iscsi)
|
||||
|
||||
int retry = 0;
|
||||
|
||||
if (old_iscsi->last_reconnect) {
|
||||
while (time(NULL) - old_iscsi->last_reconnect < 5) sleep(1);
|
||||
}
|
||||
|
||||
try_again:
|
||||
|
||||
iscsi = iscsi_create_context(old_iscsi->initiator_name);
|
||||
@@ -339,6 +343,7 @@ try_again:
|
||||
free(iscsi);
|
||||
|
||||
old_iscsi->is_reconnecting = 0;
|
||||
old_iscsi->last_reconnect = time(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user