Enhance WebSocket server connection management and error handling
- Introduce connection time tracking for WebSocket users to monitor connection duration. - Implement user ID management to allow dynamic updates and removal of connections based on user ID changes. - Add functionality to retrieve active connections, including unauthenticated ones, for administrative purposes. - Improve error handling during connection closure and ensure proper cleanup of connection entries.
This commit is contained in:
committed by
Torsten (PC)
parent
753c5929e1
commit
5ac8e9b484
@@ -36,8 +36,11 @@ if(NOT EXISTS "/etc/yourpart")
|
||||
message(STATUS "Erstelle Verzeichnis /etc/yourpart...")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "/etc/yourpart"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
RESULT_VARIABLE MKDIR_RESULT
|
||||
)
|
||||
if(NOT MKDIR_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Konnte Verzeichnis /etc/yourpart nicht erstellen")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Prüfe ob Config-Datei existiert
|
||||
@@ -45,8 +48,11 @@ if(NOT EXISTS "${CONFIG_FILE}")
|
||||
message(STATUS "Konfigurationsdatei existiert nicht, erstelle neue...")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${TEMPLATE_FILE}" "${CONFIG_FILE}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
RESULT_VARIABLE COPY_RESULT
|
||||
)
|
||||
if(NOT COPY_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Konnte Konfigurationsdatei nicht erstellen: ${CONFIG_FILE}")
|
||||
endif()
|
||||
message(STATUS "Neue Konfigurationsdatei erstellt: ${CONFIG_FILE}")
|
||||
else()
|
||||
message(STATUS "Konfigurationsdatei existiert bereits, prüfe auf fehlende Keys...")
|
||||
@@ -144,16 +150,26 @@ if __name__ == '__main__':
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Setze korrekte Berechtigungen
|
||||
# Setze korrekte Berechtigungen (Fehler werden ignoriert, da Berechtigungen optional sind)
|
||||
execute_process(
|
||||
COMMAND chown yourpart:yourpart "${CONFIG_FILE}"
|
||||
COMMAND_ERROR_IS_FATAL FALSE
|
||||
RESULT_VARIABLE CHOWN_RESULT
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if(NOT CHOWN_RESULT EQUAL 0)
|
||||
message(WARNING "Konnte Besitzer von ${CONFIG_FILE} nicht ändern (möglicherweise kein Root oder User existiert nicht)")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND chmod 600 "${CONFIG_FILE}"
|
||||
COMMAND_ERROR_IS_FATAL FALSE
|
||||
RESULT_VARIABLE CHMOD_RESULT
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if(NOT CHMOD_RESULT EQUAL 0)
|
||||
message(WARNING "Konnte Berechtigungen von ${CONFIG_FILE} nicht ändern")
|
||||
endif()
|
||||
|
||||
message(STATUS "Konfigurationsdatei-Verwaltung abgeschlossen: ${CONFIG_FILE}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user