@ -74,30 +74,30 @@ serverCtor(void * _this, va_list * params)
flags = fcntl ( this - > sock - > handle , F_GETFL , 0 ) ;
flags = fcntl ( this - > sock - > handle , F_GETFL , 0 ) ;
fcntl ( this - > sock - > handle , F_SETFL , flags | O_NONBLOCK ) ;
fcntl ( this - > sock - > handle , F_SETFL , flags | O_NONBLOCK ) ;
/ / this - > sockSSL = new ( Sock , this - > logger , port + 1 ) ;
/ / flags = fcntl ( this - > sockSSL - > handle , F_GETFL , 0 ) ;
/ / fcntl ( this - > sockSSL - > handle , F_SETFL , flags | O_NONBLOCK ) ;
/ / SSL_library_init ( ) ;
/ / SSL_load_error_strings ( ) ;
/ / this - > ctx = SSL_CTX_new ( SSLv23_server_method ( ) ) ;
/ / SSL_CTX_use_certificate_file (
/ / this - > ctx ,
/ / " ./certs/server.crt " ,
/ / SSL_FILETYPE_PEM ) ;
/ / SSL_CTX_use_RSAPrivateKey_file (
/ / this - > ctx ,
/ / " ./certs/server.key " ,
/ / SSL_FILETYPE_PEM ) ;
this - > sockSSL = new ( Sock , this - > logger , port + 1 ) ;
flags = fcntl ( this - > sockSSL - > handle , F_GETFL , 0 ) ;
fcntl ( this - > sockSSL - > handle , F_SETFL , flags | O_NONBLOCK ) ;
SSL_library_init ( ) ;
SSL_load_error_strings ( ) ;
this - > ctx = SSL_CTX_new ( SSLv23_server_method ( ) ) ;
SSL_CTX_use_certificate_file (
this - > ctx ,
" ./certs/server.crt " ,
SSL_FILETYPE_PEM ) ;
SSL_CTX_use_RSAPrivateKey_file (
this - > ctx ,
" ./certs/server.key " ,
SSL_FILETYPE_PEM ) ;
socketListen ( this - > sock , backlog ) ;
socketListen ( this - > sock , backlog ) ;
/ / socketListen ( this - > sockSSL , backlog ) ;
socketListen ( this - > sockSSL , backlog ) ;
( this - > fds ) [ 0 ] . fd = this - > sock - > handle ;
( this - > fds ) [ 0 ] . fd = this - > sock - > handle ;
( this - > fds ) [ 0 ] . events = POLLIN ;
( this - > fds ) [ 0 ] . events = POLLIN ;
/ / ( this - > fds ) [ 1 ] . fd = this - > sockSSL - > handle ;
/ / ( this - > fds ) [ 1 ] . events = POLLIN ;
( this - > fds ) [ 1 ] . fd = this - > sockSSL - > handle ;
( this - > fds ) [ 1 ] . events = POLLIN ;
this - > nfds = 2 ;
this - > nfds = 2 ;
return 0 ;
return 0 ;
@ -111,9 +111,8 @@ serverDtor(void * _this)
int i ;
int i ;
for ( i = 0 ; i < this - > nfds ; i + + ) {
for ( i = 0 ; i < this - > nfds ; i + + ) {
/ / if ( this - > sock - > handle ! = ( this - > fds ) [ i ] . fd & &
/ / this - > sockSSL - > handle ! = ( this - > fds ) [ i ] . fd ) {
if ( this - > sock - > handle ! = ( this - > fds ) [ i ] . fd ) {
if ( this - > sock - > handle ! = ( this - > fds ) [ i ] . fd & &
this - > sockSSL - > handle ! = ( this - > fds ) [ i ] . fd ) {
serverCloseConn ( this , i ) ;
serverCloseConn ( this , i ) ;
}
}
}
}
@ -122,10 +121,10 @@ serverDtor(void * _this)
MEM_FREE ( this - > conns ) ;
MEM_FREE ( this - > conns ) ;
delete ( this - > sock ) ;
delete ( this - > sock ) ;
/ / delete ( this - > sockSSL ) ;
delete ( this - > sockSSL ) ;
/ / SSL_CTX_free ( this - > ctx ) ;
/ / ERR_free_strings ( ) ;
SSL_CTX_free ( this - > ctx ) ;
ERR_free_strings ( ) ;
}
}
INIT_IFACE ( Class , serverCtor , serverDtor , NULL ) ;
INIT_IFACE ( Class , serverCtor , serverDtor , NULL ) ;