CONNECTION: Track the connection state and callback via the context structure
Dont free the connection state when login is finished, instead track it via the iscsi context structure and free it once the context is destroyed
This commit is contained in:
@@ -68,6 +68,11 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
||||
struct addrinfo *ai = NULL;
|
||||
int socksize;
|
||||
|
||||
if (iscsi->connect_data != NULL) {
|
||||
free(iscsi->connect_data);
|
||||
}
|
||||
iscsi->connect_data = private_data;
|
||||
|
||||
if (iscsi->fd != -1) {
|
||||
iscsi_set_error(iscsi,
|
||||
"Trying to connect but already connected.");
|
||||
@@ -154,7 +159,6 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
||||
}
|
||||
|
||||
iscsi->socket_status_cb = cb;
|
||||
iscsi->connect_data = private_data;
|
||||
|
||||
set_nonblocking(iscsi->fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user