Browse Source

Fehler behoben

Kolja Strohm 6 years ago
parent
commit
4fe0c9c7bd
3 changed files with 14 additions and 9 deletions
  1. 11 3
      TestWalker/ESClient.h
  2. 1 5
      TestWalker/MSClient.h
  3. 2 1
      Tests/ConnectTest/Test.cpp

+ 11 - 3
TestWalker/ESClient.h

@@ -39,7 +39,7 @@ public:
         if( k )
             abmelden();
         delete[] ip;
-        warteAufThread( 5000 );
+        warteAufThread( 10000 );
         ende();
         if( k )
             k->release();
@@ -50,6 +50,14 @@ public:
         if( k )
             return 1;
         k = new Network::Klient();
+        int l = 0;
+        char *key;
+        Keys::getServerKey( &key, l, Keys::ERHALTUNG, Keys::SENDEN );
+        k->setSendeKey( key, l );
+        delete[] key;
+        Keys::getServerKey( &key, l, Keys::ERHALTUNG, Keys::EMPFANGEN );
+        k->setEmpfangKey( key, l );
+        delete[] key;
         if( k->verbinde( port, ip ) )
         {
             k->sende( "\0", 1 ); // Verschlüsselung Aktivieren
@@ -72,8 +80,8 @@ public:
                     k->trenne();
                     return 0;
                 }
-                k->setSendeKey( (char*)key, keyLen );
-                k->setEmpfangKey( (char*)key, keyLen );
+                k->setSendeKey( (char*)this->key, keyLen );
+                k->setEmpfangKey( (char*)this->key, keyLen );
                 start();
             }
             else

+ 1 - 5
TestWalker/MSClient.h

@@ -145,9 +145,6 @@ public:
             k->getNachrichtEncrypted( (char *)lsIp, 4 );
             unsigned short lsPort = 0;
             k->getNachrichtEncrypted( (char*)&lsPort, 2 );
-            k->sendeEncrypted( "\3", 1 );
-            k->getNachrichtEncrypted( &byte, 1 );
-            k->trenne();
             Framework::Text ipT;
             ipT += (int)lsIp[ 0 ];
             ipT += ".";
@@ -156,8 +153,7 @@ public:
             ipT += (int)lsIp[ 2 ];
             ipT += ".";
             ipT += (int)lsIp[ 3 ];
-            int l = 0;
-            return new ESClient( cId, port, ipT, key, keyLen );
+            return new ESClient( cId, lsPort, ipT, key, keyLen );
         }
         else if( byte == 3 )
         {

+ 2 - 1
Tests/ConnectTest/Test.cpp

@@ -41,7 +41,8 @@ void ConnectTest::run()
 
     // TODO
     std::cout << "\x1...Abmeldung beim Server...\x1\n";
-    esc->release();
+    if( esc )
+        esc->release();
     if( !msc.unregister() )
     {
         ok = 0;