--- lbbs/src/net_server.c 2025/06/29 03:32:39 1.70 +++ lbbs/src/net_server.c 2025/10/19 01:30:38 1.73 @@ -125,6 +125,7 @@ static ssh_channel new_session_channel(s static int fork_server(void) { ssh_event event; + long int ssh_timeout = 0; int pid; int i; int ret; @@ -176,6 +177,13 @@ static int fork_server(void) ssh_callbacks_init(&cb); ssh_set_server_callbacks(SSH_session, &cb); + ssh_timeout = 60; // second + if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0) + { + log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session)); + goto cleanup; + } + if (ssh_handle_key_exchange(SSH_session)) { log_error("ssh_handle_key_exchange() error: %s\n", ssh_get_error(SSH_session)); @@ -191,7 +199,9 @@ static int fork_server(void) ret = ssh_event_dopoll(event, 100); // 0.1 second if (ret == SSH_ERROR) { +#ifdef _DEBUG log_error("ssh_event_dopoll() error: %s\n", ssh_get_error(SSH_session)); +#endif goto cleanup; } } @@ -201,6 +211,13 @@ static int fork_server(void) log_error("SSH auth error, tried %d times\n", cb_data.tries); goto cleanup; } + + ssh_timeout = 0; + if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0) + { + log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session)); + goto cleanup; + } } // Redirect Input @@ -265,6 +282,7 @@ int net_server(const char *hostaddr, in_ time_t tm_notify_child_exit = time(NULL); int sd_notify_stopping = 0; MENU_SET bbs_menu_new; + MENU_SET top10_menu_new; int i, j; pid_t pid; int ssh_log_level = SSH_LOG_NOLOG; @@ -458,13 +476,26 @@ int net_server(const char *hostaddr, in_ if (load_menu(&bbs_menu_new, CONF_MENU) < 0) { unload_menu(&bbs_menu_new); - log_error("Reload menu failed\n"); + log_error("Reload bbs menu failed\n"); } else { unload_menu(&bbs_menu); memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new)); - log_common("Reload menu successfully\n"); + log_common("Reload bbs menu successfully\n"); + } + + if (load_menu(&top10_menu_new, CONF_TOP10_MENU) < 0) + { + unload_menu(&top10_menu_new); + log_error("Reload top10 menu failed\n"); + } + else + { + unload_menu(&top10_menu); + top10_menu_new.allow_exit = 1; + memcpy(&top10_menu, &top10_menu_new, sizeof(top10_menu_new)); + log_common("Reload top10 menu successfully\n"); } for (int i = 0; i < data_files_load_startup_count; i++)