|
@@ -339,11 +339,20 @@ bool SSLServer::verbinde( unsigned short port, int warteschlangenLen )
|
|
addr.sin_port = htons( port );
|
|
addr.sin_port = htons( port );
|
|
s = socket( AF_INET, SOCK_STREAM, 0 );
|
|
s = socket( AF_INET, SOCK_STREAM, 0 );
|
|
if( s < 0 )
|
|
if( s < 0 )
|
|
|
|
+ {
|
|
|
|
+ s = 0;
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
if( bind( s, ( struct sockaddr* )&addr, sizeof( addr ) ) < 0 )
|
|
if( bind( s, ( struct sockaddr* )&addr, sizeof( addr ) ) < 0 )
|
|
|
|
+ {
|
|
|
|
+ trenne();
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
if( listen( s, warteschlangenLen ) < 0 )
|
|
if( listen( s, warteschlangenLen ) < 0 )
|
|
|
|
+ {
|
|
|
|
+ trenne();
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -357,11 +366,18 @@ SSLSKlient *SSLServer::getKlient()
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
SOCKET client = accept( s, ( struct sockaddr* )&addr, &len );
|
|
SOCKET client = accept( s, ( struct sockaddr* )&addr, &len );
|
|
if( client == INVALID_SOCKET )
|
|
if( client == INVALID_SOCKET )
|
|
|
|
+ {
|
|
|
|
+ trenne();
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
#else
|
|
#else
|
|
SOCKET client = accept( s, (sockaddr*)&addr, (socklen_t*)&len ); // Klient empfangen
|
|
SOCKET client = accept( s, (sockaddr*)&addr, (socklen_t*)&len ); // Klient empfangen
|
|
if( !client )
|
|
if( !client )
|
|
|
|
+ {
|
|
|
|
+ if( errno == ECONNABORTED || errno == EBADF )
|
|
|
|
+ trenne();
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
#endif
|
|
#endif
|
|
addr.sin_port = this->addr.sin_port;
|
|
addr.sin_port = this->addr.sin_port;
|
|
SSL *ssl = SSL_new( ctx );
|
|
SSL *ssl = SSL_new( ctx );
|
|
@@ -403,6 +419,12 @@ unsigned short SSLServer::getPort() const
|
|
return htons( addr.sin_port );
|
|
return htons( addr.sin_port );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// giebt 1 zurück, falls der Server verbunden ist
|
|
|
|
+bool SSLServer::isConnected() const
|
|
|
|
+{
|
|
|
|
+ return s != 0;
|
|
|
|
+}
|
|
|
|
+
|
|
// Reference Counting
|
|
// Reference Counting
|
|
SSLServer *SSLServer::getThis()
|
|
SSLServer *SSLServer::getThis()
|
|
{
|
|
{
|