|
@@ -11,7 +11,6 @@ EditorServer::EditorServer( InitDatei *zIni )
|
|
|
Network::Start( 100 );
|
|
|
std::cout << "EdS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
|
db = new EdSDatenbank( zIni );
|
|
|
- klientAnzahl = 0;
|
|
|
klients = new RCArray< EdSKlient >();
|
|
|
empfangen = 0;
|
|
|
gesendet = 0;
|
|
@@ -87,8 +86,7 @@ void EditorServer::thread()
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
EdSKlient *clHandle = new EdSKlient( klient, dynamic_cast<EditorServer *>( getThis() ) );
|
|
|
EnterCriticalSection( &cs );
|
|
|
- klients->set( clHandle, klientAnzahl );
|
|
|
- klientAnzahl++;
|
|
|
+ klients->add( clHandle );
|
|
|
LeaveCriticalSection( &cs );
|
|
|
clHandle->start();
|
|
|
}
|
|
@@ -102,10 +100,9 @@ void EditorServer::close()
|
|
|
warteAufThread( 1000 );
|
|
|
#endif
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
klients->z( i )->absturz();
|
|
|
klients = ( RCArray<EdSKlient>* )klients->release();
|
|
|
- klientAnzahl = 0;
|
|
|
LeaveCriticalSection( &cs );
|
|
|
ende();
|
|
|
run = 0;
|
|
@@ -208,13 +205,12 @@ bool EditorServer::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 )->getKlientNummer() == klientId )
|
|
|
{
|
|
|
klients->z( i )->absturz();
|
|
|
klients->remove( i );
|
|
|
- klientAnzahl--;
|
|
|
gefunden = 1;
|
|
|
break;
|
|
|
}
|
|
@@ -227,12 +223,11 @@ bool EditorServer::removeKlient( EdSKlient *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;
|
|
|
}
|
|
@@ -274,7 +269,7 @@ InitDatei *EditorServer::zIni() const
|
|
|
|
|
|
bool EditorServer::hatClients() const
|
|
|
{
|
|
|
- return klientAnzahl > 0;
|
|
|
+ return klients->hat(0);
|
|
|
}
|
|
|
|
|
|
int EditorServer::getId() const
|