|
@@ -4,13 +4,13 @@
|
|
#include <iostream>
|
|
#include <iostream>
|
|
#include <Klient.h>
|
|
#include <Klient.h>
|
|
#include <Globals.h>
|
|
#include <Globals.h>
|
|
-#include <AsynchronCall.h>
|
|
|
|
|
|
|
|
// Inhalt der MainServer Klasse aus MainServer.h
|
|
// Inhalt der MainServer Klasse aus MainServer.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
MainServer::MainServer( InitDatei *zDat )
|
|
MainServer::MainServer( InitDatei *zDat )
|
|
: Thread()
|
|
: Thread()
|
|
{
|
|
{
|
|
|
|
+ sslServerThread = 0;
|
|
Network::Start( 100 );
|
|
Network::Start( 100 );
|
|
std::cout << "MS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
std::cout << "MS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
db = new MSDatenbank( zDat );
|
|
db = new MSDatenbank( zDat );
|
|
@@ -45,6 +45,8 @@ MainServer::~MainServer()
|
|
{
|
|
{
|
|
ende();
|
|
ende();
|
|
serverSSL->trenne();
|
|
serverSSL->trenne();
|
|
|
|
+ if( sslServerThread )
|
|
|
|
+ delete sslServerThread;
|
|
serverSSL->release();
|
|
serverSSL->release();
|
|
server->trenne();
|
|
server->trenne();
|
|
server->release();
|
|
server->release();
|
|
@@ -79,20 +81,27 @@ void MainServer::runn()
|
|
|
|
|
|
void MainServer::thread()
|
|
void MainServer::thread()
|
|
{
|
|
{
|
|
- SSLServer *sslServer = serverSSL;
|
|
|
|
- int *cl = &clients;
|
|
|
|
MainServer *ms = this;
|
|
MainServer *ms = this;
|
|
- AsynchronCall( [ sslServer, cl, ms ]()
|
|
|
|
|
|
+ if( sslServerThread )
|
|
|
|
+ delete sslServerThread;
|
|
|
|
+ sslServerThread = new AsynchronCall( [ ms ]()
|
|
{
|
|
{
|
|
- while( sslServer->isConnected() )
|
|
|
|
|
|
+ while( ms->serverSSL->isConnected() )
|
|
{
|
|
{
|
|
- SSLSKlient *klient = sslServer->getKlient();
|
|
|
|
|
|
+ SSLSKlient *klient = ms->serverSSL->getKlient();
|
|
|
|
+ if( ms->end && klient )
|
|
|
|
+ {
|
|
|
|
+ klient->trenne();
|
|
|
|
+ klient = klient->release();
|
|
|
|
+ Sleep( 1000 );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if( !klient )
|
|
if( !klient )
|
|
continue;
|
|
continue;
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
MSKlientSSL *clHandle = new MSKlientSSL( klient, ms->getThis() );
|
|
MSKlientSSL *clHandle = new MSKlientSSL( klient, ms->getThis() );
|
|
clHandle->start();
|
|
clHandle->start();
|
|
- (*cl)++;
|
|
|
|
|
|
+ ms->clients++;
|
|
}
|
|
}
|
|
} );
|
|
} );
|
|
while( server->isConnected() )
|
|
while( server->isConnected() )
|