mirror of https://github.com/aria2/aria2
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Call ares_library_init and ares_library_cleanup if they are available. Some code cleanups. * src/Platform.ccpull/1/head
parent
3f7df00d98
commit
abcc014675
|
@ -1,3 +1,9 @@
|
||||||
|
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Call ares_library_init and ares_library_cleanup if they are
|
||||||
|
available. Some code cleanups.
|
||||||
|
* src/Platform.cc
|
||||||
|
|
||||||
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Call ares_process_fd() each time after epoll to handle timeout.
|
Call ares_process_fd() each time after epoll to handle timeout.
|
||||||
|
|
|
@ -34,13 +34,12 @@
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBSSL
|
#include <stdlib.h> /* _fmode */
|
||||||
# include <openssl/err.h>
|
#include <fcntl.h> /* _O_BINARY */
|
||||||
# include <openssl/ssl.h>
|
|
||||||
#endif // HAVE_LIBSSL
|
#include <locale.h> // For setlocale, LC_*
|
||||||
#ifdef HAVE_LIBGNUTLS
|
|
||||||
# include <gnutls/gnutls.h>
|
#include <iostream>
|
||||||
#endif // HAVE_LIBGNUTLS
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
|
||||||
|
@ -55,11 +54,20 @@
|
||||||
|
|
||||||
#endif // HAVE_WINSOCK2_H
|
#endif // HAVE_WINSOCK2_H
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSSL
|
||||||
|
# include <openssl/err.h>
|
||||||
|
# include <openssl/ssl.h>
|
||||||
|
#endif // HAVE_LIBSSL
|
||||||
|
#ifdef HAVE_LIBGNUTLS
|
||||||
|
# include <gnutls/gnutls.h>
|
||||||
|
#endif // HAVE_LIBGNUTLS
|
||||||
|
|
||||||
|
#ifdef ENABLE_ASYNC_DNS
|
||||||
|
# include <ares.h>
|
||||||
|
#endif // ENABLE_ASYNC_DNS
|
||||||
|
|
||||||
#include "DlAbortEx.h"
|
#include "DlAbortEx.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include <stdlib.h> /* _fmode */
|
|
||||||
#include <fcntl.h> /* _O_BINARY */
|
|
||||||
#include <locale.h> // For setlocale, LC_*
|
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -98,6 +106,15 @@ bool Platform::setUp()
|
||||||
gnutls_global_init();
|
gnutls_global_init();
|
||||||
#endif // HAVE_LIBGNUTLS
|
#endif // HAVE_LIBGNUTLS
|
||||||
|
|
||||||
|
#ifdef CARES_HAVE_ARES_LIBRARY_INIT
|
||||||
|
int aresErrorCode;
|
||||||
|
if((aresErrorCode = ares_library_init(ARES_LIB_INIT_ALL)) != 0) {
|
||||||
|
std::cerr << "ares_library_init() failed:"
|
||||||
|
<< ares_strerror(aresErrorCode)
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
#endif // CARES_HAVE_ARES_LIBRARY_INIT
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
memset(reinterpret_cast<char*>(&wsaData), 0, sizeof(wsaData));
|
memset(reinterpret_cast<char*>(&wsaData), 0, sizeof(wsaData));
|
||||||
|
@ -124,6 +141,10 @@ bool Platform::tearDown()
|
||||||
gnutls_global_deinit();
|
gnutls_global_deinit();
|
||||||
#endif // HAVE_LIBGNUTLS
|
#endif // HAVE_LIBGNUTLS
|
||||||
|
|
||||||
|
#ifdef CARES_HAVE_ARES_LIBRARY_CLEANUP
|
||||||
|
ares_library_cleanup();
|
||||||
|
#endif // CARES_HAVE_ARES_LIBRARY_CLEANUP
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif // HAVE_WINSOCK2_H
|
#endif // HAVE_WINSOCK2_H
|
||||||
|
|
Loading…
Reference in New Issue