Skip to content

Commit

Permalink
Merge pull request #432 from tianrenz2/fd-reuse
Browse files Browse the repository at this point in the history
lib: reserve the fd on reconnect
  • Loading branch information
sahlberg authored Nov 25, 2024
2 parents 7d1c926 + 97ba4c3 commit 041f12d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ iscsi_tcp_disconnect(struct iscsi_context *iscsi)
return -1;
}

close(iscsi->fd);
if (iscsi->old_iscsi && iscsi->old_iscsi->fd == iscsi->fd) {
/* Reserve this fd because old_iscsi->fd will be reused */
} else {
close(iscsi->fd);
}

if (!(iscsi->pending_reconnect && iscsi->old_iscsi) &&
iscsi->connected_portal[0]) {
Expand Down

0 comments on commit 041f12d

Please sign in to comment.