From: <arn...@us...> - 2006-06-10 09:48:53
|
Revision: 614 Author: arnetheduck Date: 2006-06-10 02:48:17 -0700 (Sat, 10 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=614&view=rev Log Message: ----------- patches Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/CriticalSection.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/Text.cpp dcplusplus/trunk/client/Thread.cpp dcplusplus/trunk/client/Thread.h dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/windows/AboutDlg.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/changelog.txt 2006-06-10 09:48:17 UTC (rev 614) @@ -1,4 +1,15 @@ --- 0.691 2006-06-03 -- +-- 0.692 -- +* [bug 927] Fixed OP detection bug really (thanks pothead) +* [bug 938] Added a few more ADC info fields (thanks ullner) +* [bug 939] Fixed hub info update (thanks ullner) +* [bug 940] Fixed a 64-bit compile error (thanks steven sheehy) +* [bug 942] Fixed atomic operations on unices (thanks tobias nygren) +* [bug 943] Fixed unix utsname compile issue (thanks tobias nygren) +* [bug 944] Fixed unix string conversion bug (thanks tobias nygren) +* [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) + + +-- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) * [bug 578] Added search for alternates to transfers menu (thanks trem) Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -133,17 +133,18 @@ u->getUser()->setFlag(User::SSL); } - if(u->getIdentity().isHub()) { - setHubIdentity(u->getIdentity()); - fire(ClientListener::HubUpdated(), this); - } - if(u->getUser() == ClientManager::getInstance()->getMe()) { state = STATE_NORMAL; setMyIdentity(u->getIdentity()); updateCounts(false); } - fire(ClientListener::UserUpdated(), this, *u); + + if(u->getIdentity().isHub()) { + setHubIdentity(u->getIdentity()); + fire(ClientListener::HubUpdated(), this); + } else { + fire(ClientListener::UserUpdated(), this, *u); + } } void AdcHub::handle(AdcCommand::SUP, AdcCommand& c) throw() { @@ -462,7 +463,20 @@ ADDPARAM("HR", Util::toString(counts.registered)); ADDPARAM("HO", Util::toString(counts.op)); ADDPARAM("VE", "++ " VERSIONSTRING); + ADDPARAM("US", Util::toString((long)(Util::toDouble(SETTING(UPLOAD_SPEED))*1024*1024))); + if(SETTING(MAX_DOWNLOAD_SPEED) > 0) { + ADDPARAM("DS", Util::toString((SETTING(MAX_DOWNLOAD_SPEED)*1024*8))); + } else { + ADDPARAM("DS", Util::emptyString); + } + + if(Util::getAway()){ + ADDPARAM("AW", '1'); + } else { + ADDPARAM("AW", Util::emptyString); + } + string su; if(SSLSocketFactory::getInstance()->hasCerts()) { su += ADCS_FEATURE + ","; Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -238,7 +238,7 @@ pair<OnlineIter, OnlineIter> p = onlineUsers.equal_range(user->getCID()); for(OnlineIter i = p.first; i != p.second; ++i) { if(i->second->getClient().getHubUrl() == aHubUrl) { - return i->second->getClient().getMyIdentity().isOp(); + return i->second->getIdentity().isOp(); } } return false; Modified: dcplusplus/trunk/client/CriticalSection.h =================================================================== --- dcplusplus/trunk/client/CriticalSection.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/CriticalSection.h 2006-06-10 09:48:17 UTC (rev 614) @@ -51,19 +51,20 @@ #else public: CriticalSection() throw() { -#if HAVE_DECL_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - static pthread_mutex_t recmtx = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - mtx = recmtx; -#else -#error Can not find mutex type attribute. -#endif + pthread_mutexattr_init(&ma); + pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mtx, &ma); } - ~CriticalSection() throw() { pthread_mutex_destroy(&mtx); } + ~CriticalSection() throw() { + pthread_mutex_destroy(&mtx); + pthread_mutexattr_destroy(&ma); + } void enter() throw() { pthread_mutex_lock(&mtx); } void leave() throw() { pthread_mutex_unlock(&mtx); } pthread_mutex_t& getMutex() { return mtx; } private: pthread_mutex_t mtx; + pthread_mutexattr_t ma; #endif CriticalSection(const CriticalSection&); CriticalSection& operator=(const CriticalSection&); Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/HashManager.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -631,7 +631,7 @@ { Lock l(cs); - currentSize = max(currentSize - n, _LL(0)); + currentSize = max(static_cast<u_int64_t>(currentSize - n), static_cast<u_int64_t>(0)); } sizeLeft -= n; } while (n > 0 && !stop); Modified: dcplusplus/trunk/client/Text.cpp =================================================================== --- dcplusplus/trunk/client/Text.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Text.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -148,6 +148,7 @@ if (n < 1) { return tmp; } + src = str.c_str(); tmp.resize(n); n = mbsrtowcs(&tmp[0], &src, n, NULL); if (n < 1) { @@ -188,6 +189,7 @@ if(n < 1) { return tmp; } + src = str.c_str(); tmp.resize(n); n = wcsrtombs(&tmp[0], &src, n, NULL); if(n < 1) { Modified: dcplusplus/trunk/client/Thread.cpp =================================================================== --- dcplusplus/trunk/client/Thread.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Thread.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -23,6 +23,10 @@ #include "ResourceManager.h" +#ifndef _WIN32 +pthread_mutex_t Thread::mtx = PTHREAD_MUTEX_INITIALIZER; +#endif + #ifdef _WIN32 void Thread::start() throw(ThreadException) { join(); Modified: dcplusplus/trunk/client/Thread.h =================================================================== --- dcplusplus/trunk/client/Thread.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Thread.h 2006-06-10 09:48:17 UTC (rev 614) @@ -29,10 +29,6 @@ #include <sys/resource.h> #endif -#ifdef HAVE_ASM_ATOMIC_H -#include <asm/atomic.h> -#endif - #include "Exception.h" STANDARD_EXCEPTION(ThreadException); @@ -98,24 +94,16 @@ static void sleep(u_int32_t millis) { ::usleep(millis*1000); } static void yield() { ::sched_yield(); } static long safeInc(volatile long& v) { -#ifdef HAVE_ASM_ATOMIC_H - atomic_t t = ATOMIC_INIT(v); - atomic_inc(&t); - return (v=t.counter); -#else -#warning FIXME - return ++v; -#endif + pthread_mutex_lock(&mtx); + long ret = ++v; + pthread_mutex_unlock(&mtx); + return ret; } static long safeDec(volatile long& v) { -#ifdef HAVE_ASM_ATOMIC_H - atomic_t t = ATOMIC_INIT(v); - atomic_dec(&t); - return (v=t.counter); -#else -#warning FIXME - return --v; -#endif + pthread_mutex_lock(&mtx); + long ret = --v; + pthread_mutex_unlock(&mtx); + return ret; } #endif @@ -135,6 +123,7 @@ return 0; } #else + static pthread_mutex_t mtx; pthread_t threadHandle; static void* starter(void* p) { Thread* t = (Thread*)p; Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Util.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -915,7 +915,7 @@ return os; #else // _WIN32 - utsname n; + struct utsname n; if(uname(&n) != 0) { return "unix (unknown version)"; Modified: dcplusplus/trunk/windows/AboutDlg.h =================================================================== --- dcplusplus/trunk/windows/AboutDlg.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/windows/AboutDlg.h 2006-06-10 09:48:17 UTC (rev 614) @@ -41,7 +41,8 @@ _T("theparanoidone, gadget, naga, tremor, joakim tosteberg, pofis, psf8500, lauris ievins, ") _T("defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, ") _T("bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, ") -_T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, steven. ") +_T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, steven, ") +_T("steven sheehy, tobias nygren. ") _T("Keep it coming!"); class AboutDlg : public CDialogImpl<AboutDlg>, private HttpConnectionListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |