From: <arn...@us...> - 2006-07-08 17:22:19
|
Revision: 626 Author: arnetheduck Date: 2006-07-08 10:21:56 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=626&view=rev Log Message: ----------- More minor fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/config.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/changelog.txt 2006-07-08 17:21:56 UTC (rev 626) @@ -33,6 +33,7 @@ * Added a few TLS options; [U] in transfer status means untrusted TLS (encrypted but certificate not validated) * Added certificate generation, OpenSSL must be installed and in PATH for this to work * [bug 996] Fixed an issue where directories that are hard to delete were created +* [bug 1000] Fixed linux compile issue (thanks steven sheehy) -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-08 17:21:56 UTC (rev 626) @@ -36,15 +36,15 @@ separator(aSeparator), mode(MODE_LINE), dataBytes(0), rollback(0), failed(false), sock(0), disconnecting(false), filterIn(NULL) { - sockets++; + Thread::safeInc(sockets); } -size_t BufferedSocket::sockets = 0; +volatile long BufferedSocket::sockets = 0; BufferedSocket::~BufferedSocket() throw() { delete sock; delete filterIn; - sockets--; + Thread::safeDec(sockets); } void BufferedSocket::setMode (Modes aMode, size_t aRollback) { @@ -74,22 +74,21 @@ void BufferedSocket::accept(const Socket& srv, bool secure, bool allowUntrusted) throw(SocketException, ThreadException) { dcassert(!sock); - - dcdebug("BufferedSocket::accept() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getServerSocket(allowUntrusted) : new Socket; + try { + dcdebug("BufferedSocket::accept() %p\n", (void*)this); + sock = secure ? CryptoManager::getInstance()->getServerSocket(allowUntrusted) : new Socket; - sock->accept(srv); - if(SETTING(SOCKET_IN_BUFFER) > 0) - sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); - if(SETTING(SOCKET_OUT_BUFFER) > 0) - sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); - sock->setBlocking(false); + sock->accept(srv); + if(SETTING(SOCKET_IN_BUFFER) > 0) + sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); + if(SETTING(SOCKET_OUT_BUFFER) > 0) + sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); + sock->setBlocking(false); - inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); + inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); - // This lock prevents the shutdown task from being added and executed before we're done initializing the socket - Lock l(cs); - try { + // This lock prevents the shutdown task from being added and executed before we're done initializing the socket + Lock l(cs); start(); } catch(...) { delete sock; @@ -103,20 +102,20 @@ void BufferedSocket::connect(const string& aAddress, short aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException) { dcassert(!sock); - dcdebug("BufferedSocket::connect() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getClientSocket(allowUntrusted) : new Socket; + try { + dcdebug("BufferedSocket::connect() %p\n", (void*)this); + sock = secure ? CryptoManager::getInstance()->getClientSocket(allowUntrusted) : new Socket; - sock->create(); - if(SETTING(SOCKET_IN_BUFFER) >= 1024) - sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); - if(SETTING(SOCKET_OUT_BUFFER) >= 1024) - sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); - sock->setBlocking(false); + sock->create(); + if(SETTING(SOCKET_IN_BUFFER) >= 1024) + sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); + if(SETTING(SOCKET_OUT_BUFFER) >= 1024) + sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); + sock->setBlocking(false); - inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); + inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); - Lock l(cs); - try { + Lock l(cs); start(); } catch(...) { delete sock; Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-07-08 17:21:56 UTC (rev 626) @@ -174,7 +174,7 @@ void threadDisconnect(); void fail(const string& aError); - static size_t sockets; + static volatile long sockets; bool checkEvents(); void checkSocket(); Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-07-08 17:21:56 UTC (rev 626) @@ -70,6 +70,7 @@ dh = 0; } else { SSL_CTX_set_tmp_dh(serverContext, dh); + SSL_CTX_set_tmp_dh(serverVerContext, dh); } } } @@ -79,6 +80,10 @@ SSL_CTX_free(serverContext); if(clientContext) SSL_CTX_free(clientContext); + if(serverVerContext) + SSL_CTX_free(serverVerContext); + if(clientVerContext) + SSL_CTX_free(clientVerContext); if(dh) DH_free(dh); } @@ -194,6 +199,15 @@ if(SSL_CTX_load_verify_locations(clientContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); } + if(SSL_CTX_load_verify_locations(clientVerContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } + if(SSL_CTX_load_verify_locations(serverContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } + if(SSL_CTX_load_verify_locations(serverVerContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } } while(FindNextFile(hFind, &data)); FindClose(hFind); Modified: dcplusplus/trunk/client/config.h =================================================================== --- dcplusplus/trunk/client/config.h 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/config.h 2006-07-08 17:21:56 UTC (rev 626) @@ -27,10 +27,6 @@ #include "autoconf.h" #endif -// Changing this number will change the maximum number of simultaneous users -// we can handle (when using select)... -#define FD_SETSIZE 4096 - // Remove this line if hashes are not available in your stl #define HAVE_HASH 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |