mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
poll: Added a cleanup function to free the ws2_32 library.
This commit is contained in:
@@ -77,6 +77,7 @@ typedef unsigned long int nfds_t;
|
|||||||
#endif /* HAVE_POLL */
|
#endif /* HAVE_POLL */
|
||||||
|
|
||||||
void ssh_poll_init(void);
|
void ssh_poll_init(void);
|
||||||
|
void ssh_poll_cleanup(void);
|
||||||
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout);
|
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout);
|
||||||
typedef struct ssh_poll_ctx_struct *ssh_poll_ctx;
|
typedef struct ssh_poll_ctx_struct *ssh_poll_ctx;
|
||||||
typedef struct ssh_poll_handle_struct *ssh_poll_handle;
|
typedef struct ssh_poll_handle_struct *ssh_poll_handle;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct ssh_socket_struct;
|
|||||||
typedef struct ssh_socket_struct* ssh_socket;
|
typedef struct ssh_socket_struct* ssh_socket;
|
||||||
|
|
||||||
int ssh_socket_init(void);
|
int ssh_socket_init(void);
|
||||||
|
void ssh_socket_cleanup(void);
|
||||||
ssh_socket ssh_socket_new(ssh_session session);
|
ssh_socket ssh_socket_new(ssh_session session);
|
||||||
void ssh_socket_free(ssh_socket s);
|
void ssh_socket_free(ssh_socket s);
|
||||||
void ssh_socket_set_fd(ssh_socket s, socket_t fd);
|
void ssh_socket_set_fd(ssh_socket s, socket_t fd);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ int ssh_finalize(void) {
|
|||||||
ssh_free_global_poll_ctx();
|
ssh_free_global_poll_ctx();
|
||||||
ssh_regex_finalize();
|
ssh_regex_finalize();
|
||||||
ssh_crypto_finalize();
|
ssh_crypto_finalize();
|
||||||
|
ssh_socket_cleanup();
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
gcry_control(GCRYCTL_TERM_SECMEM);
|
gcry_control(GCRYCTL_TERM_SECMEM);
|
||||||
#elif defined HAVE_LIBCRYPTO
|
#elif defined HAVE_LIBCRYPTO
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ void ssh_poll_init(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ssh_poll_cleanup(void) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
||||||
return poll((struct pollfd *) fds, nfds, timeout);
|
return poll((struct pollfd *) fds, nfds, timeout);
|
||||||
}
|
}
|
||||||
@@ -217,6 +221,14 @@ void ssh_poll_init(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ssh_poll_cleanup(void) {
|
||||||
|
win_poll = bsd_poll;
|
||||||
|
|
||||||
|
FreeLibrary(hlib);
|
||||||
|
|
||||||
|
hlib = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
||||||
return win_poll(fds, nfds, timeout);
|
return win_poll(fds, nfds, timeout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,10 +111,20 @@ int ssh_socket_init(void) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_poll_init();
|
|
||||||
#endif
|
#endif
|
||||||
|
ssh_poll_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Cleanup the socket system.
|
||||||
|
*/
|
||||||
|
void ssh_socket_cleanup(void) {
|
||||||
|
ssh_poll_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
* \internal
|
||||||
* \brief creates a new Socket object
|
* \brief creates a new Socket object
|
||||||
|
|||||||
Reference in New Issue
Block a user