Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* TCP Server for downloading PDF files
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Fritsche, NLE, 2019-04-29
|
||||
*/
|
||||
|
||||
|
||||
#include "pdf_server.h"
|
||||
#include "pdf_download.h"
|
||||
#include <nglsettings/nglsettings_connections.h>
|
||||
#include <tcpserver/cbi_help.h>
|
||||
#include <tcpserver/cbi_quit.h>
|
||||
|
||||
namespace FileManagement
|
||||
{
|
||||
PdfServer::PdfServer(MainHandler *mainHandler, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_tcpServer(TcpServer::instance(NGL::Connections::port(NGL::Connections::eConnection::FLM_PDF_SERVER)))
|
||||
, m_logger(getLogger("PdfServer"))
|
||||
{
|
||||
m_tcpServer->setUserData(mainHandler);
|
||||
m_tcpServer->setUseWorkerThreads(false);
|
||||
}
|
||||
|
||||
PdfServer::~PdfServer()
|
||||
{
|
||||
delete m_tcpServer;
|
||||
}
|
||||
|
||||
bool PdfServer::init()
|
||||
{
|
||||
const quint16 port = m_tcpServer->getListenPort();
|
||||
if (!m_tcpServer->listen(QHostAddress::Any))
|
||||
{
|
||||
FATAL_LOG(m_logger) << "Error listening on port: " << port
|
||||
<< ", error: " << m_tcpServer->errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Help>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Quit>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_PdfDownload>);
|
||||
|
||||
TcpServer::registeredCommands(port);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace FileManagement
|
||||
Reference in new issue
Block a user