server code cleanup, changed in-game ping event to not use any bandwidth as long as nothing changes

This commit is contained in:
Max-Wilhelm Bruker 2012-01-29 13:36:43 +01:00
parent a64df4a0f5
commit 4895f2b4fd
27 changed files with 232 additions and 268 deletions

View file

@ -31,7 +31,7 @@ ServerLogger::~ServerLogger()
flushBuffer();
}
void ServerLogger::logMessage(QString message, ServerSocketInterface *ssi)
void ServerLogger::logMessage(QString message, Server_ProtocolHandler *ssi)
{
if (!logFile)
return;

View file

@ -9,7 +9,7 @@
class QSocketNotifier;
class QFile;
class ServerSocketInterface;
class Server_ProtocolHandler;
class ServerLogger : public QObject {
Q_OBJECT
@ -18,7 +18,7 @@ public:
~ServerLogger();
static void hupSignalHandler(int unused);
public slots:
void logMessage(QString message, ServerSocketInterface *ssi = 0);
void logMessage(QString message, Server_ProtocolHandler *ssi = 0);
private slots:
void handleSigHup();
void flushBuffer();

View file

@ -57,6 +57,7 @@ ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_s
connect(socket, SIGNAL(disconnected()), this, SLOT(deleteLater()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(catchSocketError(QAbstractSocket::SocketError)));
connect(this, SIGNAL(outputBufferChanged()), this, SLOT(flushOutputBuffer()), Qt::QueuedConnection);
connect(this, SIGNAL(logDebugMessage(const QString &, Server_ProtocolHandler *)), logger, SLOT(logMessage(QString, Server_ProtocolHandler *)));
Event_ServerIdentification identEvent;
identEvent.set_server_name(servatrice->getServerName().toStdString());
@ -125,7 +126,6 @@ void ServerSocketInterface::readClient()
CommandContainer newCommandContainer;
newCommandContainer.ParseFromArray(inputBuffer.data(), messageLength);
logger->logMessage(QString::fromStdString(newCommandContainer.ShortDebugString()), this);
inputBuffer.remove(0, messageLength);
messageInProgress = false;