/* File transmission session */
struct SilcClientFtpSessionStruct {
SilcClient client; /* Client */
+ SilcClientConnection server_conn; /* Connection to server */
SilcClientConnection conn; /* Connection to remote host */
SilcClientEntry client_entry; /* The client entry */
SilcClientListener listener; /* Listener */
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
- /* Close the read file descriptor */
+ /* Close the real file descriptor */
silc_file_close(session->fd);
return;
}
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
- /* Close the read file descriptor */
+ /* Close the real file descriptor */
silc_file_close(session->fd);
return;
}
{
SILC_LOG_DEBUG(("Free session %d", session->session_id));
+ silc_schedule_task_del_by_context(session->client->schedule, session);
+
silc_dlist_del(session->client->internal->ftp_sessions, session);
/* Abort connecting */
if (session->stream)
silc_stream_destroy(session->stream);
- silc_client_unref_client(session->client, session->conn,
+ silc_client_unref_client(session->client, session->server_conn,
session->client_entry);
silc_free(session->hostname);
silc_free(session->filepath);
return SILC_CLIENT_FILE_ERROR;
session->session_id = ++client->internal->next_session_id;
session->client = client;
+ session->server_conn = conn;
session->initiator = TRUE;
session->client_entry = silc_client_ref_client(client, conn, client_entry);
session->monitor = monitor;
/* Add the listener for the key agreement */
SILC_LOG_DEBUG(("Creating listener for file transfer"));
if (!params || (!params->local_ip && !params->bind_ip)) {
+ session->client->internal->ops->say(session->client, session->conn,
+ SILC_CLIENT_MESSAGE_ERROR,
+ "Cannot create listener for file "
+ "transfer; IP address and/or port "
+ "not provided");
silc_free(session);
return SILC_CLIENT_FILE_ERROR;
}
SilcClientFtpSession session;
SilcClientID remote_id;
SilcClientEntry remote_client;
- SilcKeyAgreementPayload payload;
+ SilcKeyAgreementPayload payload = NULL;
char *hostname;
SilcUInt16 port;
goto out;
session->session_id = ++client->internal->next_session_id;
session->client = client;
+ session->server_conn = conn;
session->client_entry = silc_client_ref_client(client, conn,
remote_client);
if (hostname && port) {
}
out:
+ if (payload)
+ silc_key_agreement_payload_free(payload);
silc_packet_free(packet);
return SILC_FSM_FINISH;
}