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