Simplification of TLS Init and bugfixes

This commit is contained in:
René Linder 2020-11-28 10:42:10 +01:00
parent 402feb568c
commit 880246c0fb

View file

@ -237,7 +237,6 @@ Module lhs_web
Procedure start_server() Procedure start_server()
Global NewMap m_clients.s_clients(conf_max_clients) Global NewMap m_clients.s_clients(conf_max_clients)
Protected settings.ltls::s_tls_server
Protected tlsresponse.i Protected tlsresponse.i
;TODO: Create SSL Server ;TODO: Create SSL Server
@ -246,15 +245,11 @@ Module lhs_web
If conf_TLS_enable = 1 If conf_TLS_enable = 1
server_SSL_id = lsocket::CreateSocket(conf_TLS_Port, conf_max_clients, lsocket::#SOCK_STREAM, lsocket::#AF_INET, conf_TLS_binding) server_SSL_id = lsocket::CreateSocket(conf_TLS_Port, conf_max_clients, lsocket::#SOCK_STREAM, lsocket::#AF_INET, conf_TLS_binding)
If server_SSL_id If server_SSL_id
settings\CA = conf_TLS_CA tlsresponse = ltls::InitSimpleTLS(conf_TLS_CA, conf_TLS_Cert, conf_TLS_Key, conf_TLS_Key_Pass)
settings\Cert = conf_TLS_Cert
settings\Key = conf_TLS_Key
settings\Password = conf_TLS_Key_Pass
tlsresponse = ltls::InitTLS(@settings)
Debug "TLS Fehler:"+Str(tlsresponse)
If tlsresponse > 0 If tlsresponse > 0
CreateThread(@server_SSL(), server_SSL_id) CreateThread(@server_SSL(), server_SSL_id)
Else Else
Debug "TLS Fehler:"+Str(tlsresponse)
ProcedureReturn #False ProcedureReturn #False
EndIf EndIf
@ -298,13 +293,13 @@ Module lhs_web
count_client + 1 count_client + 1
Else Else
Debug "Max TLS Clients reached..." Debug "Max TLS Clients reached..."
CloseNetworkConnection(client_id) ltls::CloseTLSSocket(client_id)
EndIf EndIf
Else Else
Break Break
EndIf EndIf
ForEver ForEver
ltls::CloseTLS(network_server_id)
EndProcedure EndProcedure