|
@@ -42,7 +42,6 @@ PatchServer::PatchServer( InitDatei *zIni )
|
|
|
InitializeCriticalSection( &cs );
|
|
|
updateAnzahl = 0;
|
|
|
updateGruppe = new Array< int >();
|
|
|
- ref = 1;
|
|
|
if( zIni->zWert( "Aktiv" )->istGleich( "TRUE" ) )
|
|
|
{
|
|
|
serverStarten();
|
|
@@ -82,7 +81,7 @@ void PatchServer::runn()
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- PSAKlient *clHandle = new PSAKlient( klient, getThis(), ini->getThis() );
|
|
|
+ PSAKlient * clHandle = new PSAKlient( klient, (PatchServer *)getThis(), ini->getThis() );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -96,7 +95,7 @@ void PatchServer::thread()
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- PSKlient *clHandle = new PSKlient( klient, getThis(), ini->getThis() );
|
|
|
+ PSKlient * clHandle = new PSKlient( klient, (PatchServer *)getThis(), ini->getThis() );
|
|
|
EnterCriticalSection( &cs );
|
|
|
klients->set( clHandle, klientAnzahl );
|
|
|
klientAnzahl++;
|
|
@@ -121,7 +120,7 @@ void PatchServer::close()
|
|
|
ende();
|
|
|
run = 0;
|
|
|
end = 1;
|
|
|
- Klient *klient = new Klient();
|
|
|
+ Klient * klient = new Klient();
|
|
|
klient->verbinde( aServer->getPort(), "127.0.0.1" );
|
|
|
Sleep( 500 );
|
|
|
aServer->trenne();
|
|
@@ -234,7 +233,7 @@ bool PatchServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool PatchServer::removeKlient( PSKlient *zKlient )
|
|
|
+bool PatchServer::removeKlient( PSKlient * zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
@@ -281,7 +280,7 @@ bool PatchServer::beginnUpdate( int gruppe )
|
|
|
}
|
|
|
if( !db->setDateiGruppe( id, gruppe, true ) )
|
|
|
return 0;
|
|
|
- Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
+ Text * gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
return 0;
|
|
|
Result systemT = db->getSystemListe();
|
|
@@ -293,7 +292,7 @@ bool PatchServer::beginnUpdate( int gruppe )
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad->getText() );
|
|
|
+ InitDatei * vIni = new InitDatei( pfad->getText() );
|
|
|
vIni->laden();
|
|
|
pfad->remove( pfad->getLength() - 11, pfad->getLength() );
|
|
|
Result dateiT = db->getDeletedFiles( TextZuInt( systemT.values[ i * 2 ].getText(), 10 ), gruppe );
|
|
@@ -403,13 +402,13 @@ bool PatchServer::proveVersion( int gruppe ) const
|
|
|
Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
continue;
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text * pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei * vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
int dAnz = vIni->getWertAnzahl();
|
|
|
if( dAnz != dateiT.zeilenAnzahl ) // nicht aktuell
|
|
@@ -469,13 +468,13 @@ bool PatchServer::proveVersion() const
|
|
|
Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
continue;
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text * pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei * vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
int dAnz = vIni->getWertAnzahl();
|
|
|
if( dAnz != dateiT.zeilenAnzahl ) // nicht aktuell
|
|
@@ -538,25 +537,10 @@ bool PatchServer::proveVersion() const
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-// Reference Counting
|
|
|
-PatchServer *PatchServer::getThis()
|
|
|
-{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
-}
|
|
|
-
|
|
|
-PatchServer *PatchServer::release()
|
|
|
-{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
// Inhalt der PSAKlient Klasse aus PatchServer.h
|
|
|
// Konstruktor
|
|
|
-PSAKlient::PSAKlient( SSLSKlient *klient, PatchServer *ps, InitDatei *ini )
|
|
|
+PSAKlient::PSAKlient( SSLSKlient * klient, PatchServer * ps, InitDatei * ini )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -600,13 +584,13 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char len = 0;
|
|
|
- klient->getNachricht( (char*)&len, 1 );
|
|
|
+ klient->getNachricht( (char *)& len, 1 );
|
|
|
char *n = new char[ len + 1 ];
|
|
|
n[ (int)len ] = 0;
|
|
|
if( len )
|
|
|
klient->getNachricht( n, len );
|
|
|
unsigned char pLen = 0;
|
|
|
- klient->getNachricht( (char*)&pLen, 1 );
|
|
|
+ klient->getNachricht( (char *)& pLen, 1 );
|
|
|
char *p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
@@ -702,7 +686,7 @@ void PSAKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
ok = 1;
|
|
|
- if( ok && ps->hatClients() )
|
|
|
+ if( ok &&ps->hatClients() )
|
|
|
{
|
|
|
errorZuKlient( "Es sind noch Klients Online. Bitte versuche es später erneut." );
|
|
|
break;
|
|
@@ -800,7 +784,7 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxC = 0;
|
|
|
- klient->getNachricht( (char*)&maxC, 4 );
|
|
|
+ klient->getNachricht( (char *)& maxC, 4 );
|
|
|
if( ps->zDB()->adminHatRecht( adminId, Admin_Recht::PSMCChange ) )
|
|
|
{
|
|
|
if( ps->setMaxKlients( maxC ) )
|
|
@@ -830,16 +814,16 @@ void PSAKlient::thread()
|
|
|
for( int i = 0; i < systemT.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int len = systemT.values[ i * 2 + 1 ].getLength();
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
klient->sende( systemT.values[ i * 2 + 1 ].getText(), len );
|
|
|
Result dateiT = ps->zDB()->getDateiListeOhneOrdner( TextZuInt( systemT.values[ i * 2 ].getText(), 10 ), updateGruppe );
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text * pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei * vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
for( int j = 0; j < dateiT.zeilenAnzahl; j++ )
|
|
|
{
|
|
@@ -851,7 +835,7 @@ void PSAKlient::thread()
|
|
|
if( veraltet )
|
|
|
{
|
|
|
int len = dateiT.values[ j * 2 ].getLength();
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
klient->sende( dateiT.values[ j * 2 ].getText(), len );
|
|
|
}
|
|
|
}
|
|
@@ -895,7 +879,7 @@ void PSAKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int dg = 0;
|
|
|
- klient->getNachricht( (char*)&dg, 4 );
|
|
|
+ klient->getNachricht( (char *)& dg, 4 );
|
|
|
gruppeN = ps->zDB()->getDateiGruppeName( dg );
|
|
|
if( !gruppeN )
|
|
|
{
|
|
@@ -935,12 +919,12 @@ void PSAKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int system = 0;
|
|
|
- klient->getNachricht( (char*)&system, 4 );
|
|
|
+ klient->getNachricht( (char *)& system, 4 );
|
|
|
int version = 0;
|
|
|
- klient->getNachricht( (char*)&version, 4 );
|
|
|
+ klient->getNachricht( (char *)& version, 4 );
|
|
|
Text *sName = ps->zDB()->getSystemName( system );
|
|
|
unsigned short len = 0;
|
|
|
- klient->getNachricht( (char*)&len, 2 );
|
|
|
+ klient->getNachricht( (char *)& len, 2 );
|
|
|
char *pfad = new char[ len + 1 ];
|
|
|
pfad[ len ] = 0;
|
|
|
if( len )
|
|
@@ -970,14 +954,14 @@ void PSAKlient::thread()
|
|
|
if( d->open( Datei::Style::schreiben ) )
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
- klient->getNachricht( (char*)&len, 2 );
|
|
|
+ klient->getNachricht( (char *)& len, 2 );
|
|
|
while( len )
|
|
|
{
|
|
|
char *buff = new char[ len ];
|
|
|
klient->getNachricht( buff, len );
|
|
|
d->schreibe( buff, len );
|
|
|
delete[] buff;
|
|
|
- klient->getNachricht( (char*)&len, 2 );
|
|
|
+ klient->getNachricht( (char *)& len, 2 );
|
|
|
ps->addEmpfangen( klient->getDownloadBytes( 1 ) );
|
|
|
ps->addGesendet( klient->getUploadBytes( 1 ) );
|
|
|
}
|
|
@@ -1006,8 +990,8 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char*)&klientId, 4 );
|
|
|
- if( klientId && ps->absturzKlient( klientId ) )
|
|
|
+ klient->getNachricht( (char *)& klientId, 4 );
|
|
|
+ if( klientId &&ps->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
klient->sende( "\0", 1 );
|
|
@@ -1022,26 +1006,26 @@ void PSAKlient::thread()
|
|
|
errorZuKlient( "Du hast kein Recht diese Operation durchzuführen." );
|
|
|
else
|
|
|
{
|
|
|
- Array< FileGroupInfo* > list;
|
|
|
+ Array< FileGroupInfo * > list;
|
|
|
if( ps->zDB()->getFileGroupInfoList( ps->getId(), &list ) )
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int anz = list.getEintragAnzahl();
|
|
|
- klient->sende( (char*)&anz, 4 );
|
|
|
+ klient->sende( (char *)& anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
FileGroupInfo *info = list.get( i );
|
|
|
- klient->sende( (char*)&info->id, 4 );
|
|
|
+ klient->sende( (char *)& info->id, 4 );
|
|
|
unsigned char len = (unsigned char)info->name.getLength();
|
|
|
- klient->sende( (char*)&len, 1 );
|
|
|
+ klient->sende( (char *)& len, 1 );
|
|
|
klient->sende( info->name, len );
|
|
|
len = (unsigned char)info->status.getLength();
|
|
|
- klient->sende( (char*)&len, 1 );
|
|
|
+ klient->sende( (char *)& len, 1 );
|
|
|
klient->sende( info->status, len );
|
|
|
unsigned short l = (unsigned short)info->pfad.getLength();
|
|
|
- klient->sende( (char*)&l, 2 );
|
|
|
+ klient->sende( (char *)& l, 2 );
|
|
|
klient->sende( info->pfad, l );
|
|
|
- klient->sende( (char*)&info->version, 4 );
|
|
|
+ klient->sende( (char *)& info->version, 4 );
|
|
|
delete info;
|
|
|
}
|
|
|
}
|
|
@@ -1061,13 +1045,13 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
Result res = ps->zDB()->getSystemListe();
|
|
|
- klient->sende( (char*)&res.zeilenAnzahl, 4 );
|
|
|
+ klient->sende( (char *)& res.zeilenAnzahl, 4 );
|
|
|
for( int i = 0; i < res.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int id = res.values[ i * 2 ];
|
|
|
- klient->sende( (char*)&id, 4 );
|
|
|
+ klient->sende( (char *)& id, 4 );
|
|
|
unsigned char len = (unsigned char)res.values[ i * 2 + 1 ].getLength();
|
|
|
- klient->sende( (char*)&len, 1 );
|
|
|
+ klient->sende( (char *)& len, 1 );
|
|
|
klient->sende( res.values[ i * 2 + 1 ], len );
|
|
|
}
|
|
|
res.destroy();
|
|
@@ -1085,21 +1069,21 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int system, group;
|
|
|
- klient->getNachricht( (char*)&system, 4 );
|
|
|
- klient->getNachricht( (char*)&group, 4 );
|
|
|
+ klient->getNachricht( (char *)& system, 4 );
|
|
|
+ klient->getNachricht( (char *)& group, 4 );
|
|
|
Result res = ps->zDB()->getDateiListeSMP( system, group );
|
|
|
- klient->sende( (char*)&res.zeilenAnzahl, 4 );
|
|
|
+ klient->sende( (char *)& res.zeilenAnzahl, 4 );
|
|
|
for( int i = 0; i < res.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int id = res.values[ i * 4 ];
|
|
|
- klient->sende( (char*)&id, 4 );
|
|
|
+ klient->sende( (char *)& id, 4 );
|
|
|
unsigned short len = (unsigned short)res.values[ i * 4 + 1 ].getLength();
|
|
|
- klient->sende( (char*)&len, 2 );
|
|
|
+ klient->sende( (char *)& len, 2 );
|
|
|
klient->sende( res.values[ i * 4 + 1 ], len );
|
|
|
int version = res.values[ i * 4 + 2 ];
|
|
|
- klient->sende( (char*)&version, 4 );
|
|
|
+ klient->sende( (char *)& version, 4 );
|
|
|
unsigned char l = (unsigned char)res.values[ i * 4 + 3 ].getLength();
|
|
|
- klient->sende( (char*)&l, 1 );
|
|
|
+ klient->sende( (char *)& l, 1 );
|
|
|
klient->sende( res.values[ i * 4 + 3 ], l );
|
|
|
}
|
|
|
res.destroy();
|
|
@@ -1118,15 +1102,15 @@ void PSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int group, system;
|
|
|
unsigned short len;
|
|
|
- klient->getNachricht( (char*)&len, 2 );
|
|
|
+ klient->getNachricht( (char *)& len, 2 );
|
|
|
char *path = new char[ len + 1 ];
|
|
|
klient->getNachricht( path, len );
|
|
|
path[ len ] = 0;
|
|
|
- klient->getNachricht( (char*)&group, 4 );
|
|
|
- klient->getNachricht( (char*)&system, 4 );
|
|
|
+ klient->getNachricht( (char *)& group, 4 );
|
|
|
+ klient->getNachricht( (char *)& system, 4 );
|
|
|
int version = ps->zDB()->getDateiVersion( path, system, group );
|
|
|
delete[] path;
|
|
|
- klient->sende( (char*)&version, 4 );
|
|
|
+ klient->sende( (char *)& version, 4 );
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -1141,18 +1125,18 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned short len;
|
|
|
- klient->getNachricht( (char*)&len, 2 );
|
|
|
+ klient->getNachricht( (char *)& len, 2 );
|
|
|
char *path = new char[ len + 1 ];
|
|
|
klient->getNachricht( path, len );
|
|
|
path[ len ] = 0;
|
|
|
unsigned char l;
|
|
|
- klient->getNachricht( (char*)&l, 1 );
|
|
|
+ klient->getNachricht( (char *)& l, 1 );
|
|
|
char *time = new char[ l + 1 ];
|
|
|
klient->getNachricht( time, l );
|
|
|
time[ l ] = 0;
|
|
|
int system, gruppe;
|
|
|
- klient->getNachricht( (char*)&system, 4 );
|
|
|
- klient->getNachricht( (char*)&gruppe, 4 );
|
|
|
+ klient->getNachricht( (char *)& system, 4 );
|
|
|
+ klient->getNachricht( (char *)& gruppe, 4 );
|
|
|
if( ps->zDB()->updateDatei( path, time, system, gruppe ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1171,7 +1155,7 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int gruppe;
|
|
|
- klient->getNachricht( (char*)&gruppe, 4 );
|
|
|
+ klient->getNachricht( (char *)& gruppe, 4 );
|
|
|
if( ps->zDB()->dateiGruppeUpdate( gruppe ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1207,19 +1191,18 @@ void PSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehl
|
|
|
|
|
|
// Inhalt der PSKlient aus PatchServer.h
|
|
|
// Konstruktor
|
|
|
-PSKlient::PSKlient( SKlient *klient, PatchServer *ps, InitDatei *ini )
|
|
|
+PSKlient::PSKlient( SKlient * klient, PatchServer * ps, InitDatei * ini )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
unsigned char key[ 20 ] = { 102, 139, 140, 143, 52, 52, 194, 167, 97, 106, 23, 72, 170, 121, 213, 178, 28, 28, 124, 185 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
+ klient->setSendeKey( (char *)key, 20 );
|
|
|
+ klient->setEmpfangKey( (char *)key, 20 );
|
|
|
klientNummer = 0;
|
|
|
system = 0;
|
|
|
this->ps = ps;
|
|
|
this->ini = ini;
|
|
|
encrypted = 0;
|
|
|
- ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
@@ -1257,13 +1240,13 @@ void PSKlient::thread()
|
|
|
case 1: // Klient identifikation
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->getNachrichtEncrypted( (char*)&klientNummer, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&system, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& system, 1 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->getNachricht( (char*)&klientNummer, 4 );
|
|
|
- klient->getNachricht( (char*)&system, 1 );
|
|
|
+ klient->getNachricht( (char *)& klientNummer, 4 );
|
|
|
+ klient->getNachricht( (char *)& system, 1 );
|
|
|
}
|
|
|
if( !ps->zDB()->proveKlient( klientNummer, ps->getId() ) )
|
|
|
{
|
|
@@ -1305,16 +1288,16 @@ void PSKlient::thread()
|
|
|
int klientId = 0;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
- if( klientId && ps->absturzKlient( klientId ) )
|
|
|
+ klient->getNachrichtEncrypted( (char *)& klientId, 4 );
|
|
|
+ if( klientId &&ps->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
|
klient->sendeEncrypted( "\0", 1 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->getNachricht( (char*)&klientId, 4 );
|
|
|
- if( klientId && ps->absturzKlient( klientId ) )
|
|
|
+ klient->getNachricht( (char *)& klientId, 4 );
|
|
|
+ if( klientId &&ps->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
klient->sende( "\0", 1 );
|
|
@@ -1430,18 +1413,18 @@ void PSKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char byte = 0;
|
|
|
- klient->getNachricht( (char*)&byte, 1 );
|
|
|
+ klient->getNachricht( (char *)& byte, 1 );
|
|
|
Text *pfad = new Text( "" );
|
|
|
pfad->fillText( ' ', byte );
|
|
|
klient->getNachricht( pfad->getText(), byte );
|
|
|
__int64 pos = 0;
|
|
|
- klient->getNachricht( (char *)&pos, 8 );
|
|
|
+ klient->getNachricht( (char *)& pos, 8 );
|
|
|
if( system )
|
|
|
pfad->insert( 0, "../versions/x64/live/" );
|
|
|
else
|
|
|
pfad->insert( 0, "../versions/x32/live/" );
|
|
|
pfad->ersetzen( "ü", "ue" );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei * datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
datei->open( Datei::Style::lesen );
|
|
|
if( pos )
|
|
@@ -1460,14 +1443,14 @@ void PSKlient::thread()
|
|
|
byteLen = 2048;
|
|
|
if( length < 2048 )
|
|
|
byteLen = (unsigned short)length;
|
|
|
- klient->sende( (char*)&byteLen, 2 );
|
|
|
+ klient->sende( (char *)& byteLen, 2 );
|
|
|
datei->lese( bytes, byteLen );
|
|
|
klient->sende( bytes, byteLen );
|
|
|
length -= byteLen;
|
|
|
char ret = 0;
|
|
|
if( byteLen != 2048 )
|
|
|
break;
|
|
|
- klient->getNachricht( (char *)&ret, 1 );
|
|
|
+ klient->getNachricht( (char *)& ret, 1 );
|
|
|
ps->addEmpfangen( klient->getDownloadBytes( 1 ) );
|
|
|
ps->addGesendet( klient->getUploadBytes( 1 ) );
|
|
|
if( ret == 1 )
|
|
@@ -1477,7 +1460,7 @@ void PSKlient::thread()
|
|
|
if( ret == 2 )
|
|
|
{
|
|
|
pos = 0;
|
|
|
- klient->getNachricht( (char *)&pos, 8 );
|
|
|
+ klient->getNachricht( (char *)& pos, 8 );
|
|
|
if( pos > length )
|
|
|
pos = length;
|
|
|
datei->setLPosition( pos, 0 );
|
|
@@ -1500,7 +1483,7 @@ void PSKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int version = 30;
|
|
|
- klient->sende( (char*)&version, 4 );
|
|
|
+ klient->sende( (char *)& version, 4 );
|
|
|
}
|
|
|
break;
|
|
|
case 8: // Frage nach Dateigröße ****Altes Update System
|
|
@@ -1522,11 +1505,11 @@ void PSKlient::thread()
|
|
|
else
|
|
|
pfad->insert( 0, "../versions/x32/live/" );
|
|
|
pfad->ersetzen( "ü", "ue" );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei * datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
__int64 size = datei->getSize();
|
|
|
datei->release();
|
|
|
- klient->sende( (char *)&size, 8 );
|
|
|
+ klient->sende( (char *)& size, 8 );
|
|
|
}
|
|
|
break;
|
|
|
case 9: // Frage nach Dateiliste ****Neues Update System
|
|
@@ -1543,9 +1526,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char *)& updateGruppe, 4 );
|
|
|
Result dateien = ps->zDB()->getDateiListeOhneOrdner( system, updateGruppe );
|
|
|
if( !dateien.zeilenAnzahl )
|
|
|
{
|
|
@@ -1565,17 +1548,17 @@ void PSKlient::thread()
|
|
|
break;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 4 );
|
|
|
klient->sendeEncrypted( dateien.values[ i * 2 ].getText(), len );
|
|
|
int version = TextZuInt( dateien.values[ i * 2 + 1 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char*)&version, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& version, 4 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
klient->sende( dateien.values[ i * 2 ].getText(), len );
|
|
|
int version = TextZuInt( dateien.values[ i * 2 + 1 ].getText(), 10 );
|
|
|
- klient->sende( (char*)&version, 4 );
|
|
|
+ klient->sende( (char *)& version, 4 );
|
|
|
}
|
|
|
}
|
|
|
if( encrypted )
|
|
@@ -1589,12 +1572,12 @@ void PSKlient::thread()
|
|
|
break;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 4 );
|
|
|
klient->sendeEncrypted( deleted.values[ i ].getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
klient->sende( deleted.values[ i ].getText(), len );
|
|
|
}
|
|
|
}
|
|
@@ -1620,9 +1603,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char *)& updateGruppe, 4 );
|
|
|
if( !ps->zDB()->supportedDateiGruppe( ps->getId(), updateGruppe ) )
|
|
|
{
|
|
|
int s = ps->zDB()->getDateiGruppePatchServer( klientNummer, updateGruppe );
|
|
@@ -1636,18 +1619,18 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
- klient->sendeEncrypted( (char*)ip->getText(), len );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)ip->getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
klient->sende( "\2", 1 );
|
|
|
- klient->sende( (char*)&port, 4 );
|
|
|
+ klient->sende( (char *)& port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
- klient->sende( (char*)ip->getText(), len );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
+ klient->sende( (char *)ip->getText(), len );
|
|
|
}
|
|
|
}
|
|
|
ip->release();
|
|
@@ -1678,9 +1661,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int len = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&len, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& len, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&len, 4 );
|
|
|
+ klient->getNachricht( (char *)& len, 4 );
|
|
|
char *pf = new char[ len + 1 ];
|
|
|
pf[ len ] = 0;
|
|
|
if( encrypted )
|
|
@@ -1689,14 +1672,14 @@ void PSKlient::thread()
|
|
|
klient->getNachricht( pf, len );
|
|
|
pfad->append( pf );
|
|
|
delete[] pf;
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei * datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
__int64 size = datei->getSize();
|
|
|
datei->release();
|
|
|
if( encrypted )
|
|
|
- klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
else
|
|
|
- klient->sende( (char *)&size, 8 );
|
|
|
+ klient->sende( (char *)& size, 8 );
|
|
|
}
|
|
|
break;
|
|
|
case 11: // Frage nach Datei ****Neues Update System
|
|
@@ -1713,9 +1696,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char *)& updateGruppe, 4 );
|
|
|
if( !ps->zDB()->supportedDateiGruppe( ps->getId(), updateGruppe ) )
|
|
|
{
|
|
|
int s = ps->zDB()->getDateiGruppePatchServer( klientNummer, updateGruppe );
|
|
@@ -1729,18 +1712,18 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
- klient->sendeEncrypted( (char*)ip->getText(), len );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)ip->getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
klient->sende( "\2", 1 );
|
|
|
- klient->sende( (char*)&port, 4 );
|
|
|
+ klient->sende( (char *)& port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
- klient->sende( (char*)ip->getText(), len );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
+ klient->sende( (char *)ip->getText(), len );
|
|
|
}
|
|
|
}
|
|
|
ip->release();
|
|
@@ -1771,9 +1754,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int len = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&len, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& len, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&len, 4 );
|
|
|
+ klient->getNachricht( (char *)& len, 4 );
|
|
|
char *pf = new char[ len + 1 ];
|
|
|
pf[ len ] = 0;
|
|
|
if( encrypted )
|
|
@@ -1784,10 +1767,10 @@ void PSKlient::thread()
|
|
|
delete[] pf;
|
|
|
__int64 pos = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char*)&pos, 8 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& pos, 8 );
|
|
|
else
|
|
|
- klient->getNachricht( (char*)&pos, 8 );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ klient->getNachricht( (char *)& pos, 8 );
|
|
|
+ Datei * datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
datei->open( Datei::Style::lesen );
|
|
|
if( pos )
|
|
@@ -1806,7 +1789,7 @@ void PSKlient::thread()
|
|
|
byteLen = 2048;
|
|
|
if( length < 2048 )
|
|
|
byteLen = (unsigned short)length;
|
|
|
- if( !klient->sende( (char*)&byteLen, 2 ) )
|
|
|
+ if( !klient->sende( (char *)&byteLen, 2 ) )
|
|
|
break;
|
|
|
datei->lese( bytes, byteLen );
|
|
|
if( !klient->sende( bytes, byteLen ) )
|
|
@@ -1845,24 +1828,24 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
int id = TextZuInt( dgl.values[ i * 3 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char*)&id, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& id, 4 );
|
|
|
int len = dgl.values[ i * 3 + 1 ].getLength();
|
|
|
- klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 4 );
|
|
|
if( len )
|
|
|
klient->sendeEncrypted( dgl.values[ i * 3 + 1 ].getText(), len );
|
|
|
int vs = TextZuInt( dgl.values[ i * 3 + 2 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char*)&vs, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)& vs, 4 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int id = TextZuInt( dgl.values[ i * 3 ].getText(), 10 );
|
|
|
- klient->sende( (char*)&id, 4 );
|
|
|
+ klient->sende( (char *)& id, 4 );
|
|
|
int len = dgl.values[ i * 3 + 1 ].getLength();
|
|
|
- klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char *)& len, 4 );
|
|
|
if( len )
|
|
|
klient->sende( dgl.values[ i * 3 + 1 ].getText(), len );
|
|
|
int vs = TextZuInt( dgl.values[ i * 3 + 2 ].getText(), 10 );
|
|
|
- klient->sende( (char*)&vs, 4 );
|
|
|
+ klient->sende( (char *)& vs, 4 );
|
|
|
}
|
|
|
}
|
|
|
if( encrypted )
|
|
@@ -1923,19 +1906,4 @@ bool PSKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehle
|
|
|
int PSKlient::getKlientNummer() const // gibt die KlientId zurück
|
|
|
{
|
|
|
return klientNummer;
|
|
|
-}
|
|
|
-
|
|
|
-// Reference Counting
|
|
|
-PSKlient *PSKlient::getThis()
|
|
|
-{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
-}
|
|
|
-
|
|
|
-PSKlient *PSKlient::release()
|
|
|
-{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
}
|