|
@@ -11,7 +11,6 @@ HistorieServer::HistorieServer( InitDatei *zIni )
|
|
Network::Start( 100 );
|
|
Network::Start( 100 );
|
|
std::cout << "HS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
std::cout << "HS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
db = new HSDatenbank( zIni );
|
|
db = new HSDatenbank( zIni );
|
|
- klientAnzahl = 0;
|
|
|
|
klients = new RCArray< HSKlient >();
|
|
klients = new RCArray< HSKlient >();
|
|
empfangen = 0;
|
|
empfangen = 0;
|
|
gesendet = 0;
|
|
gesendet = 0;
|
|
@@ -87,8 +86,7 @@ void HistorieServer::thread()
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
HSKlient *clHandle = new HSKlient( klient, dynamic_cast<HistorieServer *>( getThis() ) );
|
|
HSKlient *clHandle = new HSKlient( klient, dynamic_cast<HistorieServer *>( getThis() ) );
|
|
EnterCriticalSection( &cs );
|
|
EnterCriticalSection( &cs );
|
|
- klients->set( clHandle, klientAnzahl );
|
|
|
|
- klientAnzahl++;
|
|
|
|
|
|
+ klients->add( clHandle );
|
|
LeaveCriticalSection( &cs );
|
|
LeaveCriticalSection( &cs );
|
|
clHandle->start();
|
|
clHandle->start();
|
|
}
|
|
}
|
|
@@ -99,10 +97,9 @@ void HistorieServer::close()
|
|
db->setServerStatus( id, 1 );
|
|
db->setServerStatus( id, 1 );
|
|
server->trenne();
|
|
server->trenne();
|
|
EnterCriticalSection( &cs );
|
|
EnterCriticalSection( &cs );
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
klients->z( i )->absturz();
|
|
klients->z( i )->absturz();
|
|
klients = ( RCArray<HSKlient> * )klients->release();
|
|
klients = ( RCArray<HSKlient> * )klients->release();
|
|
- klientAnzahl = 0;
|
|
|
|
LeaveCriticalSection( &cs );
|
|
LeaveCriticalSection( &cs );
|
|
ende();
|
|
ende();
|
|
run = 0;
|
|
run = 0;
|
|
@@ -205,13 +202,12 @@ bool HistorieServer::absturzKlient( int klientId )
|
|
{
|
|
{
|
|
bool gefunden = 0;
|
|
bool gefunden = 0;
|
|
EnterCriticalSection( &cs );
|
|
EnterCriticalSection( &cs );
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
{
|
|
{
|
|
if( klients->z( i ) && klients->z( i )->getKlientNummer() == klientId )
|
|
if( klients->z( i ) && klients->z( i )->getKlientNummer() == klientId )
|
|
{
|
|
{
|
|
klients->z( i )->absturz();
|
|
klients->z( i )->absturz();
|
|
klients->remove( i );
|
|
klients->remove( i );
|
|
- klientAnzahl--;
|
|
|
|
gefunden = 1;
|
|
gefunden = 1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -224,12 +220,11 @@ bool HistorieServer::removeKlient( HSKlient *zKlient )
|
|
{
|
|
{
|
|
bool gefunden = 0;
|
|
bool gefunden = 0;
|
|
EnterCriticalSection( &cs );
|
|
EnterCriticalSection( &cs );
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
{
|
|
{
|
|
if( klients->z( i ) == zKlient )
|
|
if( klients->z( i ) == zKlient )
|
|
{
|
|
{
|
|
klients->remove( i );
|
|
klients->remove( i );
|
|
- klientAnzahl--;
|
|
|
|
gefunden = 1;
|
|
gefunden = 1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -266,7 +261,7 @@ HSDatenbank *HistorieServer::zDB() const
|
|
|
|
|
|
bool HistorieServer::hatClients() const
|
|
bool HistorieServer::hatClients() const
|
|
{
|
|
{
|
|
- return klientAnzahl > 0;
|
|
|
|
|
|
+ return klients->hat(0);
|
|
}
|
|
}
|
|
|
|
|
|
int HistorieServer::getId() const
|
|
int HistorieServer::getId() const
|