Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
/*
* @RDE_HEADER@
* Listen Server for Tetra Simulation
* $Id$
* $HeadURL$
* $Author$
*/
#include "server.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtNetwork/QTcpSocket>
#include "worker.h"
TTServer::TTServer(const TTSArgs &ttsArgs)
: m_ttsArgs(ttsArgs)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("TTServer"))
{
connect(this, &TTServer::newConnection,
this, &TTServer::onNewConnection);
}
void TTServer::onNewConnection()
{
QTcpSocket *sock = nextPendingConnection();
if (!sock)
return;
NOTICE_LOG(m_logger) << "New incoming connection from "
<< sock->peerName() << ":"
<< sock->peerPort();
TTWorker *ttw = new TTWorker(sock, m_ttsArgs);
if (!ttw->init())
exit(5);
connect(sock, &QTcpSocket::disconnected,
this, &TTServer::onDisconnect);
}
void TTServer::onDisconnect()
{
NOTICE_LOG(m_logger) << "Disconnected";
}