Przeglądaj źródła

einiegeFehler behoben

Kolja Strohm 6 lat temu
rodzic
commit
125b3fd023
4 zmienionych plików z 19 dodań i 2 usunięć
  1. 3 0
      Network Linux.vcxproj
  2. 6 0
      Network/Klient.cpp
  3. 3 2
      Network/Network.cpp
  4. 7 0
      Network/Server.cpp

+ 3 - 0
Network Linux.vcxproj

@@ -81,6 +81,9 @@
       </ForceUndefineSymbolReferences>
       <UnresolvedSymbolReferences>false</UnresolvedSymbolReferences>
     </Link>
+    <CustomBuildStep>
+      <Outputs>kopieren;%(Outputs)</Outputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets" />

+ 6 - 0
Network/Klient.cpp

@@ -251,7 +251,11 @@ SSLKlient::~SSLKlient()
         this->ip->release();
     if( connected )
         trenne();
+    BIO_free_all( bio );
     SSL_CTX_free( ctx );
+#ifdef WIN32
+    OPENSSL_thread_stop();
+#endif
 }
 
 bool SSLKlient::verbinde( unsigned short port, const char *ip ) // verbindet mit Server
@@ -265,6 +269,8 @@ bool SSLKlient::verbinde( unsigned short port, const char *ip ) // verbindet mit
     adr += port;
     BIO_set_conn_hostname( bio, adr );
     connected = BIO_do_connect( bio ) > 0;
+    if( connected && BIO_do_handshake( bio ) <= 0 )
+        trenne();
     return connected;
 }
 

+ 3 - 2
Network/Network.cpp

@@ -2,6 +2,7 @@
 #ifndef WIN32
 #include <iostream>
 #include <netdb.h>
+#include <signal.h>
 #endif
 #include <openssl/err.h>
 #include <openssl/ssl.h>
@@ -16,11 +17,11 @@ void Network::Start( int maxClients )
 	int fehler = WSAStartup( MAKEWORD( 2, 0 ), &lpwd );
 	if( fehler != 0 )
 		MessageBox( 0, "Win Sock 2.0 konnte nocht gestartet werden.", "Fehler", MB_ICONERROR );
+#else
+    signal( SIGPIPE, SIG_IGN );
 #endif
     SSL_library_init();
     SSL_load_error_strings();
-    ERR_load_BIO_strings();
-    OpenSSL_add_all_algorithms();
 }
 
 void Network::getHostName( char *name, int bufferLen )

+ 7 - 0
Network/Server.cpp

@@ -329,7 +329,11 @@ SSLServer::SSLServer()
 SSLServer::~SSLServer()
 {
     trenne();
+    SSL_CTX_free( ctx );
     passw->release();
+#ifdef WIN32
+    OPENSSL_thread_stop();
+#endif
 }
 
 // nicht constant 
@@ -474,6 +478,9 @@ SSLSKlient::SSLSKlient( sockaddr_in client, SSL *ssl, SOCKET s )
 SSLSKlient::~SSLSKlient()
 {
     trenne();
+#ifdef WIN32
+    OPENSSL_thread_stop();
+#endif
 }
 
 // nicht constant