[brlcad-commits] SF.net SVN: brlcad:[36773]
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <dav...@us...> - 2009-12-02 20:45:25
|
Revision: 36773 http://brlcad.svn.sourceforge.net/brlcad/?rev=36773&view=rev Author: davidloman Date: 2009-12-02 20:45:16 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Integrate Logger into various places. Modified Paths: -------------- rt^3/trunk/include/GS/GeometryService.h rt^3/trunk/include/GS/NetSockPortal.h rt^3/trunk/include/GS/NetSockPortalManager.h rt^3/trunk/src/GS/GeometryService.cxx rt^3/trunk/src/GS/NetSockPortal.cxx rt^3/trunk/src/GS/NetSockPortalManager.cxx Modified: rt^3/trunk/include/GS/GeometryService.h =================================================================== --- rt^3/trunk/include/GS/GeometryService.h 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/include/GS/GeometryService.h 2009-12-02 20:45:16 UTC (rev 36773) @@ -49,7 +49,7 @@ private: QString localHostname; NetSockPortalManager* portalMan; - + Logger* log; }; #endif Modified: rt^3/trunk/include/GS/NetSockPortal.h =================================================================== --- rt^3/trunk/include/GS/NetSockPortal.h 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/include/GS/NetSockPortal.h 2009-12-02 20:45:16 UTC (rev 36773) @@ -29,6 +29,7 @@ #include <QTcpSocket> #include <QString> +#include "GE/Logger.h" #include "GS/netMsg/NetMsgFactory.h" class NetSockPortal: public QTcpSocket @@ -63,6 +64,7 @@ private: QString remHostName; + Logger* log; NetMsgFactory* factory; Modified: rt^3/trunk/include/GS/NetSockPortalManager.h =================================================================== --- rt^3/trunk/include/GS/NetSockPortalManager.h 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/include/GS/NetSockPortalManager.h 2009-12-02 20:45:16 UTC (rev 36773) @@ -26,6 +26,7 @@ #define __NETSOCKPORTALMANAGER_H__ #include "GS/NetSockPortal.h" +#include "GE/Logger.h" #include <QTcpServer> #include <QHostAddress> @@ -59,11 +60,13 @@ private: QString localHostName; + Logger* log; QMap<QString, NetSockPortal*>* portalList; void sendLocalHostName(NetSockPortal* nsp); NetSockPortal* preparePortal(); + }; #endif Modified: rt^3/trunk/src/GS/GeometryService.cxx =================================================================== --- rt^3/trunk/src/GS/GeometryService.cxx 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/src/GS/GeometryService.cxx 2009-12-02 20:45:16 UTC (rev 36773) @@ -28,6 +28,9 @@ GeometryService::GeometryService(int& argc, char* argv[], QString hostname) : QCoreApplication(argc, argv), localHostname(hostname) { + + this->log = Logger::getInstance(); + this->portalMan = new NetSockPortalManager(hostname); // Modified: rt^3/trunk/src/GS/NetSockPortal.cxx =================================================================== --- rt^3/trunk/src/GS/NetSockPortal.cxx 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/src/GS/NetSockPortal.cxx 2009-12-02 20:45:16 UTC (rev 36773) @@ -28,9 +28,13 @@ #include "GS/netMsg/NetMsg.h" #include "GS/netMsg/RemHostNameSetMsg.h" +#include <QHostAddress> + NetSockPortal::NetSockPortal(QObject* parent) : QTcpSocket(parent) { + this->log = Logger::getInstance(); + QObject::connect(this, SIGNAL(readyRead()), this, SLOT( moveDataFromSocketBuffer())); @@ -50,6 +54,12 @@ this->factory->addData(data); this->factory->attemptToMakeMsgs(); + QString msg; + msg += "New data from: " + this->peerAddress().toString() + ". "; + msg += this->factory->getInboxSize() + " Msgs in factory inbox.\n"; + + this->log->log(Logger::INFO, msg); + if (this->hasMsg()) { @@ -102,9 +112,14 @@ void NetSockPortal::send(NetMsg& msg) { QByteArray ba; - msg.serialize(&ba); + QString str; + str += "Sending msg of type: " + msg.getMsgType(); + str += ", id: " + msg.getMsgUUID(); + str += ", length: " + QString::number(ba.size()) + "\n"; + this->log->log(Logger::INFO, str); + quint64 totalToSend = ba.size(); quint64 thisSend = 0; quint64 totalSent = 0; @@ -138,7 +153,12 @@ void NetSockPortal::disconnect(quint8 reason) { - //TODO finish Implementing this. + QString msg; + msg += "Disconnected from: " + this->peerAddress().toString() + " (" + + this->remHostName + "). Reason code: " + reason + "\n"; + this->log->log(Logger::INFO, msg); + + this->disconnectFromHost(); } bool NetSockPortal::hasMsg() @@ -151,7 +171,6 @@ return this->factory->getNextMsg(); } - QString NetSockPortal::getRemoteHostName() { return this->remHostName; Modified: rt^3/trunk/src/GS/NetSockPortalManager.cxx =================================================================== --- rt^3/trunk/src/GS/NetSockPortalManager.cxx 2009-12-02 20:34:28 UTC (rev 36772) +++ rt^3/trunk/src/GS/NetSockPortalManager.cxx 2009-12-02 20:45:16 UTC (rev 36773) @@ -31,6 +31,7 @@ NetSockPortalManager::NetSockPortalManager(QString hostName, QObject* parent) : QTcpServer(parent), localHostName(hostName) { + this->log = Logger::getInstance(); this->portalList = new QMap<QString, NetSockPortal*> (); } @@ -40,6 +41,10 @@ NetSockPortal* NetSockPortalManager::connectTo(QHostAddress addy, quint16 port) { + QString msg; + msg += "Attempting to connect to: " + addy.toString() + ":" + port + "\n"; + this->log->log(Logger::INFO, msg); + NetSockPortal* nsp = this->preparePortal(); nsp->portStatus = NetSockPortal::NotConnected; @@ -82,6 +87,10 @@ { NetSockPortal* nsp = (NetSockPortal*) sender(); + QString msg; + msg += "Accepted new connection from: " + nsp->peerAddress().toString() + ":" + nsp->peerPort() + "\n"; + this->log->log(Logger::INFO, msg); + //Send the localhostName to the Remote machine. this->sendLocalHostName(nsp); @@ -100,6 +109,10 @@ QObject::disconnect(nsp, SIGNAL(portalHandshakeComplete()), this, SLOT( handlePortalHandshakeCompleted())); + + QString msg; + msg += "Handshake with " + nsp->getRemoteHostName() + " completed.\n"; + this->log->log(Logger::INFO, msg); } void NetSockPortalManager::handlePortalDisconnect() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |