From: Jacek S. <arn...@us...> - 2006-02-19 23:51:38
|
Update of /cvsroot/dcplusplus/dcplusplus/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18176/client Modified Files: NmdcHub.h Client.h BufferedSocket.cpp ClientManager.cpp Client.cpp Log Message: Last few cleanups for the day Index: ClientManager.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/ClientManager.cpp,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** ClientManager.cpp 18 Feb 2006 23:32:17 -0000 1.96 --- ClientManager.cpp 19 Feb 2006 23:51:31 -0000 1.97 *************** *** 55,62 **** void ClientManager::putClient(Client* aClient) { ! aClient->disconnect(true); fire(ClientManagerListener::ClientDisconnected(), aClient); aClient->removeListeners(); ! { Lock l(cs); --- 55,63 ---- void ClientManager::putClient(Client* aClient) { ! aClient->shutdown(); ! fire(ClientManagerListener::ClientDisconnected(), aClient); aClient->removeListeners(); ! { Lock l(cs); Index: BufferedSocket.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/BufferedSocket.cpp,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** BufferedSocket.cpp 19 Feb 2006 16:19:06 -0000 1.102 --- BufferedSocket.cpp 19 Feb 2006 23:51:31 -0000 1.103 *************** *** 362,366 **** delete this; } - } --- 362,365 ---- Index: NmdcHub.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/NmdcHub.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NmdcHub.h 19 Feb 2006 20:39:20 -0000 1.32 --- NmdcHub.h 19 Feb 2006 23:51:31 -0000 1.33 *************** *** 27,33 **** #include "SettingsManager.h" - #include "ClientManager.h" - - #include "BufferedSocket.h" #include "User.h" #include "CriticalSection.h" --- 27,30 ---- *************** *** 35,38 **** --- 32,37 ---- #include "Client.h" + class ClientManager; + class NmdcHub : public Client, private TimerManagerListener, private Flags { *************** *** 40,43 **** --- 39,43 ---- using Client::send; + virtual void connect(); virtual void connect(const OnlineUser& aUser); virtual void disconnect(bool graceless) throw(); *************** *** 96,101 **** NmdcHub& operator=(const NmdcHub&); - virtual void connect(); - void clearUsers(); void onLine(const string& aLine) throw(); --- 96,99 ---- Index: Client.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/Client.h,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** Client.h 19 Feb 2006 20:39:20 -0000 1.110 --- Client.h 19 Feb 2006 23:51:31 -0000 1.111 *************** *** 30,34 **** class Client; class AdcCommand; ! class ClientListener { --- 30,34 ---- class Client; class AdcCommand; ! class ClientManager; class ClientListener { *************** *** 84,90 **** typedef List::iterator Iter; - Client(const string& hubURL, char separator, bool secure_); - virtual ~Client() throw(); - virtual void connect(); virtual void disconnect(bool graceless) { if(socket) socket->disconnect(graceless); } --- 84,87 ---- *************** *** 129,132 **** --- 126,131 ---- } + void shutdown(); + void send(const string& aMessage) { send(aMessage.c_str(), aMessage.length()); } void send(const char* aMessage, size_t aLen) { *************** *** 156,159 **** --- 155,161 ---- protected: + friend class ClientManager; + Client(const string& hubURL, char separator, bool secure_); + virtual ~Client() throw(); struct Counts { Counts(long n = 0, long r = 0, long o = 0) : normal(n), registered(r), op(o) { } Index: Client.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/Client.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** Client.cpp 19 Feb 2006 16:19:06 -0000 1.93 --- Client.cpp 19 Feb 2006 23:51:31 -0000 1.94 *************** *** 39,47 **** Client::~Client() throw() { ! if(socket) ! BufferedSocket::putSocket(socket); updateCounts(true); } void Client::reloadSettings() { FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); --- 39,53 ---- Client::~Client() throw() { ! dcassert(!socket); updateCounts(true); } + void Client::shutdown() { + if(socket) { + BufferedSocket::putSocket(socket); + socket = 0; + } + } + void Client::reloadSettings() { FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); |