diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-05-17 11:19:31 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-05-17 11:19:31 +0200 |
commit | 488e822c8d242760f3f47e10d7f071edee65923f (patch) | |
tree | 25569716b98d2c4c101c48ad900edb8458a4738a /libssh | |
parent | 2234c115f25ccf606d28981711bc75871fbd2505 (diff) | |
download | libssh-488e822c8d242760f3f47e10d7f071edee65923f.tar.gz libssh-488e822c8d242760f3f47e10d7f071edee65923f.tar.xz libssh-488e822c8d242760f3f47e10d7f071edee65923f.zip |
poll: Added a cleanup function to free the ws2_32 library.
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/init.c | 1 | ||||
-rw-r--r-- | libssh/poll.c | 12 | ||||
-rw-r--r-- | libssh/socket.c | 12 |
3 files changed, 24 insertions, 1 deletions
diff --git a/libssh/init.c b/libssh/init.c index 5725fef0..e1159feb 100644 --- a/libssh/init.c +++ b/libssh/init.c @@ -72,6 +72,7 @@ int ssh_finalize(void) { ssh_free_global_poll_ctx(); ssh_regex_finalize(); ssh_crypto_finalize(); + ssh_socket_cleanup(); #ifdef HAVE_LIBGCRYPT gcry_control(GCRYCTL_TERM_SECMEM); #elif defined HAVE_LIBCRYPTO diff --git a/libssh/poll.c b/libssh/poll.c index dc28b9b0..67671a09 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -67,6 +67,10 @@ void ssh_poll_init(void) { return; } +void ssh_poll_cleanup(void) { + return; +} + int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int 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) { return win_poll(fds, nfds, timeout); } diff --git a/libssh/socket.c b/libssh/socket.c index 7c5a83f0..9350bcab 100644 --- a/libssh/socket.c +++ b/libssh/socket.c @@ -111,10 +111,20 @@ int ssh_socket_init(void) { return -1; } - ssh_poll_init(); #endif + ssh_poll_init(); + return 0; } + +/** + * @brief Cleanup the socket system. + */ +void ssh_socket_cleanup(void) { + ssh_poll_cleanup(); +} + + /** * \internal * \brief creates a new Socket object |