1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

Added initialisation logs for threading

This commit is contained in:
Aris Adamantiadis
2010-09-12 21:53:42 +02:00
parent b7af2b2959
commit 5eb7c7b6ec
3 changed files with 12 additions and 5 deletions

View File

@@ -26,6 +26,7 @@
#include <libssh/callbacks.h> #include <libssh/callbacks.h>
LIBSSH_API int ssh_threads_init(void); LIBSSH_API int ssh_threads_init(void);
LIBSSH_API void ssh_threads_finalize(void); void ssh_threads_finalize(void);
const char *ssh_threads_get_type(void);
#endif /* THREADS_H_ */ #endif /* THREADS_H_ */

View File

@@ -36,7 +36,7 @@
#include "libssh/socket.h" #include "libssh/socket.h"
#include "libssh/session.h" #include "libssh/session.h"
#include "libssh/dh.h" #include "libssh/dh.h"
#include "libssh/threads.h"
#define set_status(session, status) do {\ #define set_status(session, status) do {\
if (session->callbacks && session->callbacks->connect_status_function) \ if (session->callbacks && session->callbacks->connect_status_function) \
session->callbacks->connect_status_function(session->callbacks->userdata, status); \ session->callbacks->connect_status_function(session->callbacks->userdata, status); \
@@ -680,7 +680,7 @@ int ssh_connect(ssh_session session) {
leave_function(); leave_function();
return SSH_ERROR; return SSH_ERROR;
} }
ssh_log(session,SSH_LOG_RARE,"libssh %s, using threading %s", ssh_copyright(), ssh_threads_get_type());
session->ssh_connection_callback = ssh_client_connection_callback; session->ssh_connection_callback = ssh_client_connection_callback;
session->session_state=SSH_SESSION_STATE_CONNECTING; session->session_state=SSH_SESSION_STATE_CONNECTING;
ssh_socket_set_callbacks(session->socket,&session->socket_callbacks); ssh_socket_set_callbacks(session->socket,&session->socket_callbacks);

View File

@@ -49,7 +49,7 @@ struct ssh_threads_callbacks_struct ssh_threads_noop =
.thread_id=threads_id_noop .thread_id=threads_id_noop
}; };
static struct ssh_threads_callbacks_struct *user_callbacks; static struct ssh_threads_callbacks_struct *user_callbacks =&ssh_threads_noop;
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
@@ -158,6 +158,12 @@ int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct *cb){
return SSH_OK; return SSH_OK;
} }
const char *ssh_threads_get_type(){
if(user_callbacks != NULL)
return user_callbacks->type;
return NULL;
}
/** /**
* @} * @}
*/ */