File tree Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -898,16 +898,37 @@ free_main_control()
898
898
static void
899
899
clear_main_control ()
900
900
{
901
- assert (main_ctl );
902
- if (main_ctl -> ticker_ping ) evtimer_del (main_ctl -> ticker_ping );
903
- if (main_ctl -> tcp_mux_ping_event ) evtimer_del (main_ctl -> tcp_mux_ping_event );
901
+ // Sanity check
902
+ if (!main_ctl ) {
903
+ debug (LOG_ERR , "main_ctl is NULL" );
904
+ return ;
905
+ }
906
+
907
+ // Clear timers
908
+ if (main_ctl -> ticker_ping ) {
909
+ evtimer_del (main_ctl -> ticker_ping );
910
+ main_ctl -> ticker_ping = NULL ;
911
+ }
912
+
913
+ if (main_ctl -> tcp_mux_ping_event ) {
914
+ evtimer_del (main_ctl -> tcp_mux_ping_event );
915
+ main_ctl -> tcp_mux_ping_event = NULL ;
916
+ }
917
+
918
+ // Clean up proxy clients and crypto context
904
919
clear_all_proxy_client ();
905
920
free_evp_cipher_ctx ();
921
+
922
+ // Reset state variables
906
923
set_client_status (0 );
907
- pong_time = 0 ;
924
+ pong_time = 0 ;
908
925
is_login = 0 ;
909
- if (get_common_config ()-> tcp_mux )
926
+
927
+ // Reinitialize multiplexer stream if TCP multiplexing is enabled
928
+ struct common_conf * conf = get_common_config ();
929
+ if (conf && conf -> tcp_mux ) {
910
930
init_tmux_stream (& main_ctl -> stream , get_next_session_id (), INIT );
931
+ }
911
932
}
912
933
913
934
void close_main_control ()
You can’t perform that action at this time.
0 commit comments