Browse Source

Endloßschleife beim unerwarteten Verbindungsabbruch entfernt

Kolja Strohm 7 years ago
parent
commit
cd97ab998d
4 changed files with 13 additions and 12 deletions
  1. 4 4
      Network/Klient.cpp
  2. 2 1
      Network/Network.vcxproj
  3. 4 4
      Network/Server.cpp
  4. 3 3
      build.bat

+ 4 - 4
Network/Klient.cpp

@@ -88,7 +88,7 @@ bool Klient::sende( const char *nachricht, int len ) // sendet zum Server
 #else
         int l = (int)send( sock, nachricht + ll, len, MSG_NOSIGNAL );
 #endif
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;
@@ -103,7 +103,7 @@ bool Klient::getNachricht( char *nachricht, int len ) // empf
     while( len > 0 )
     {
         int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;
@@ -126,7 +126,7 @@ bool Klient::sendeEncrypted( const char *nachricht, int len ) // sendet zum Serv
 #else
         int l = (int)send( sock, n->getBytes() + ll, len, MSG_NOSIGNAL );
 #endif
-        if( l < 0 )
+        if( l <= 0 )
         {
             n->release();
             return 0; // Fehler
@@ -147,7 +147,7 @@ bool Klient::getNachrichtEncrypted( char *nachricht, int len ) // empf
     while( len > 0 )
     {
         int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;

+ 2 - 1
Network/Network.vcxproj

@@ -120,7 +120,8 @@
     <CustomBuildStep>
       <Command>copy "..\x64\Debug\Network.dll" "..\..\..\Spiele Platform\Klient\Start\Start\network.dll"
 copy "..\x64\Debug\Network.dll" "..\..\..\Spiele Platform\Klient\patcher\patcher\network.dll"
-copy "..\x64\Debug\Network.dll" "..\..\..\Spiele Platform\SMP\SMP\network.dll"</Command>
+copy "..\x64\Debug\Network.dll" "..\..\..\Spiele Platform\SMP\SMP\network.dll"
+copy "..\x64\Debug\Network.dll" "..\..\..\Spiele Platform\Klient\Fertig\Debug\x64\network.dll"</Command>
       <Outputs>kopiere...;%(Outputs)</Outputs>
     </CustomBuildStep>
   </ItemDefinitionGroup>

+ 4 - 4
Network/Server.cpp

@@ -159,7 +159,7 @@ bool SKlient::sende( const char *nachricht, int len ) // sendet zum Klient
 #else
         int l = (int)send( sock, nachricht + ll, len, MSG_NOSIGNAL );
 #endif
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;
@@ -176,7 +176,7 @@ bool SKlient::getNachricht( char *nachricht, int len ) // empf
     while( len > 0 )
     {
         int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;
@@ -198,7 +198,7 @@ bool SKlient::sendeEncrypted( const char *nachricht, int len ) // sendet zum Ser
 #else
         int l = (int)send( sock, n->getBytes() + ll, len, MSG_NOSIGNAL );
 #endif
-        if( l < 0 )
+        if( l <= 0 )
         {
             n->release();
             return 0; // Fehler
@@ -219,7 +219,7 @@ bool SKlient::getNachrichtEncrypted( char *nachricht, int len ) // empf
     while( len > 0 )
     {
         int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
-        if( l < 0 )
+        if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;

+ 3 - 3
build.bat

@@ -1,6 +1,6 @@
-"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" Network.sln /t:Network:rebuild /p:configuration=debug /p:platform=x64
-"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" Network.sln /t:Network:rebuild /p:configuration=release /p:platform=x64
-"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" Network.sln /t:Network:rebuild /p:configuration=release /p:platform=win32
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Network/Network.vcxproj" /p:configuration=debug /p:platform=x64
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Network/Network.vcxproj" /p:configuration=release /p:platform=x64
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Network/Network.vcxproj" /p:configuration=release /p:platform=win32
 
 "D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Network Linux.vcxproj" /t:rebuild /p:configuration=debug /p:platform=x64
 "D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Network Linux.vcxproj" /t:rebuild /p:configuration=release /p:platform=x64