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:
Ronnie Sahlberg
2012-08-02 08:51:25 +10:00
parent d5d062a494
commit 439f68e555
3 changed files with 8 additions and 8 deletions

View File

@@ -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);