SOCKET add more skill to interface binding

If a process opens more than once connection the interfaces are assigned
round-robin from the available ones. However, different processes will
uses a random interface of as starting point. This patch will also
make the redirect case handled correctly.
This commit is contained in:
Peter Lieven
2012-11-06 15:47:30 +01:00
parent f00cd04810
commit 3e57a612db
3 changed files with 18 additions and 5 deletions

View File

@@ -91,6 +91,7 @@ iscsi_login_cb(struct iscsi_context *iscsi, int status, void *command_data _U_,
if (status == SCSI_STATUS_REDIRECT && iscsi->target_address[0]) {
iscsi_disconnect(iscsi);
if (iscsi->bind_interfaces[0]) iscsi_decrement_iface_rr();
if (iscsi_connect_async(iscsi, iscsi->target_address, iscsi_connect_cb, iscsi->connect_data) != 0) {
iscsi_free(iscsi, ct);
return;
@@ -238,6 +239,9 @@ try_again:
strncpy(iscsi->portal,old_iscsi->portal,MAX_STRING_SIZE);
strncpy(iscsi->bind_interfaces,old_iscsi->bind_interfaces,MAX_STRING_SIZE);
iscsi->bind_interfaces_cnt = old_iscsi->bind_interfaces_cnt;
iscsi->debug = old_iscsi->debug;
iscsi->tcp_user_timeout = old_iscsi->tcp_user_timeout;