|
|
|
@ -74,31 +74,32 @@ serverCtor(void * _this, va_list * params) |
|
|
|
flags = fcntl(this->sock->handle, F_GETFL, 0); |
|
|
|
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->sockSSL, backlog); |
|
|
|
// socketListen(this->sockSSL, backlog); |
|
|
|
|
|
|
|
(this->fds)[0].fd = this->sock->handle; |
|
|
|
(this->fds)[0].events = POLLIN; |
|
|
|
(this->fds)[1].fd = this->sockSSL->handle; |
|
|
|
(this->fds)[1].events = POLLIN; |
|
|
|
this->nfds = 2; |
|
|
|
// (this->fds)[1].fd = this->sockSSL->handle; |
|
|
|
// (this->fds)[1].events = POLLIN; |
|
|
|
// this->nfds = 2; |
|
|
|
this->nfds = 1; |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
@ -121,10 +122,10 @@ serverDtor(void * _this) |
|
|
|
MEM_FREE(this->conns); |
|
|
|
|
|
|
|
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); |
|
|
|
|