diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-05-31 10:31:07 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-05-31 10:31:07 +0000 |
| commit | 54ee6c46273a92fd8639961c059051eafdd618b4 (patch) | |
| tree | bc5cbf66c2d409a3cac609bce60d30ad5b40438a /src/SocketCore.h | |
| parent | 242267028d336a2f116210eb253f49720f4a2acc (diff) | |
2008-05-31 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added epoll support. Use epoll if it is available. If not, use
select.
When async dns is enabled in compile time, epoll support is
enabled
only when aria2 is built with c-ares. This condition statement
is
defined in a2io.h.
Currently aria2 supports both c-ares and ares, but ares is
maintained
for quite a while and debian already has c-ares package, ares
support
will be dropped in the future version.
* configure.ac
* src/AbstractCommand.cc
* src/AsyncNameResolver.cc
* src/AsyncNameResolver.h
* src/Command.cc
* src/Command.h
* src/DownloadEngine.cc
* src/DownloadEngine.h
* src/PeerAbstractCommand.cc
* src/SocketCore.cc
* src/SocketCore.h
* src/a2io.h
Diffstat (limited to 'src/SocketCore.h')
| -rw-r--r-- | src/SocketCore.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/SocketCore.h b/src/SocketCore.h index 7d605de6..7ee56b93 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -36,6 +36,7 @@ #define _D_SOCKET_CORE_H_ #include "common.h" +#include "a2io.h" #include "a2netcompat.h" #include "a2time.h" #include <cstdlib> @@ -50,6 +51,9 @@ #ifdef HAVE_LIBGNUTLS # include <gnutls/gnutls.h> #endif // HAVE_LIBGNUTLS +#ifdef HAVE_EPOLL +# include <sys/epoll.h> +#endif // HAVE_EPOLL namespace aria2 { @@ -62,6 +66,16 @@ private: int _sockType; // socket endpoint descriptor int sockfd; + +#ifdef HAVE_EPOLL + + // file descriptor used for epoll + int _epfd; + + struct epoll_event _epEvent; + +#endif // HAVE_EPOLL + bool blocking; bool secure; #ifdef HAVE_LIBSSL @@ -83,6 +97,13 @@ private: #endif // HAVE_LIBGNUTLS void init(); + +#ifdef HAVE_EPOLL + + void initEPOLL(); + +#endif // HAVE_EPOLL + SocketCore(int sockfd, int sockType); static int error(); static const char *errorMsg(); @@ -156,7 +177,7 @@ public: * @return true if the socket is available for writing, * otherwise returns false. */ - bool isWritable(time_t timeout) const; + bool isWritable(time_t timeout); /** * Checks whether this socket is available for reading. @@ -165,7 +186,7 @@ public: * @return true if the socket is available for reading, * otherwise returns false. */ - bool isReadable(time_t timeout) const; + bool isReadable(time_t timeout); /** * Writes characters into this socket. data is a pointer pointing the first |
