From 52316b09723bb004d2479fa897677eaa62e28d57 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 8 Nov 2008 10:48:02 +0000 Subject: 2008-11-08 Tatsuhiro Tsujikawa Introduced TLSContext that holds TLS related data that can be shared with multiple SSL connections. * src/DownloadEngineFactory.cc * src/LibgnutlsTLSContext.cc * src/LibgnutlsTLSContext.h * src/LibsslTLSContext.cc * src/LibsslTLSContext.h * src/Makefile.am * src/SocketCore.cc * src/SocketCore.h * src/TLSContext.h * src/message.h --- src/SocketCore.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/SocketCore.h') diff --git a/src/SocketCore.h b/src/SocketCore.h index fd1a3396..e55c387f 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -54,12 +54,15 @@ # include #endif // HAVE_LIBGNUTLS +#include "SharedHandle.h" #include "a2io.h" #include "a2netcompat.h" #include "a2time.h" namespace aria2 { +class TLSContext; + class SocketCore { friend bool operator==(const SocketCore& s1, const SocketCore& s2); friend bool operator!=(const SocketCore& s1, const SocketCore& s2); @@ -85,16 +88,18 @@ private: bool _wantRead; bool _wantWrite; +#if ENABLE_SSL + static SharedHandle _tlsContext; +#endif + #ifdef HAVE_LIBSSL // for SSL - SSL_CTX* sslCtx; SSL* ssl; int sslHandleEAGAIN(int ret); #endif // HAVE_LIBSSL #ifdef HAVE_LIBGNUTLS gnutls_session_t sslSession; - gnutls_certificate_credentials_t sslXcred; char* peekBuf; size_t peekBufLength; size_t peekBufMax; @@ -317,6 +322,8 @@ public: * readData() or writeData() and the socket needs to write more data. */ bool wantWrite() const; + + static void setTLSContext(const SharedHandle& tlsContext); }; } // namespace aria2 -- cgit