libssh2: only set the memory callbacks when debugging
This makes us debug libssh2 less and libcurl more when for example running torture tests that otherwise will spend a lot of time in libssh2 functions. We leave libssh2 to test libssh2. Closes #10721
This commit is contained in:
parent
56f306a5a6
commit
8b5f100db3
@ -100,10 +100,11 @@
|
|||||||
|
|
||||||
/* Local functions: */
|
/* Local functions: */
|
||||||
static const char *sftp_libssh2_strerror(unsigned long err);
|
static const char *sftp_libssh2_strerror(unsigned long err);
|
||||||
|
#ifdef CURL_LIBSSH2_DEBUG
|
||||||
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);
|
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);
|
||||||
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);
|
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);
|
||||||
static LIBSSH2_FREE_FUNC(my_libssh2_free);
|
static LIBSSH2_FREE_FUNC(my_libssh2_free);
|
||||||
|
#endif
|
||||||
static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data);
|
static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data);
|
||||||
static CURLcode ssh_connect(struct Curl_easy *data, bool *done);
|
static CURLcode ssh_connect(struct Curl_easy *data, bool *done);
|
||||||
static CURLcode ssh_multi_statemach(struct Curl_easy *data, bool *done);
|
static CURLcode ssh_multi_statemach(struct Curl_easy *data, bool *done);
|
||||||
@ -283,6 +284,8 @@ static CURLcode libssh2_session_error_to_CURLE(int err)
|
|||||||
return CURLE_SSH;
|
return CURLE_SSH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CURL_LIBSSH2_DEBUG
|
||||||
|
|
||||||
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)
|
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)
|
||||||
{
|
{
|
||||||
(void)abstract; /* arg not used */
|
(void)abstract; /* arg not used */
|
||||||
@ -302,6 +305,8 @@ static LIBSSH2_FREE_FUNC(my_libssh2_free)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SSH State machine related code
|
* SSH State machine related code
|
||||||
*/
|
*/
|
||||||
@ -3268,9 +3273,13 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
|
|||||||
sock = conn->sock[FIRSTSOCKET];
|
sock = conn->sock[FIRSTSOCKET];
|
||||||
#endif /* CURL_LIBSSH2_DEBUG */
|
#endif /* CURL_LIBSSH2_DEBUG */
|
||||||
|
|
||||||
|
#ifdef CURL_LIBSSH2_DEBUG
|
||||||
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
|
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
|
||||||
my_libssh2_free,
|
my_libssh2_free,
|
||||||
my_libssh2_realloc, data);
|
my_libssh2_realloc, data);
|
||||||
|
#else
|
||||||
|
sshc->ssh_session = libssh2_session_init();
|
||||||
|
#endif
|
||||||
if(!sshc->ssh_session) {
|
if(!sshc->ssh_session) {
|
||||||
failf(data, "Failure initialising ssh session");
|
failf(data, "Failure initialising ssh session");
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user