--- lbbs/src/bbs_net.c 2025/06/16 14:30:44 1.49 +++ lbbs/src/bbs_net.c 2025/06/18 04:38:20 1.52 @@ -14,14 +14,13 @@ * * ***************************************************************************/ -#define _POSIX_C_SOURCE 200809L - #include "bbs.h" #include "common.h" #include "log.h" #include "io.h" #include "screen.h" #include "menu.h" +#include "login.h" #include #include #include @@ -408,7 +407,7 @@ int bbsnet_connect(int n) goto cleanup; } - BBS_last_access_tm = t_used = time(0); + BBS_last_access_tm = t_used = time(NULL); loop = 1; while (loop && !SYS_server_exit) @@ -433,7 +432,7 @@ int bbsnet_connect(int n) } else if (nfds == 0) // timeout { - if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME) + if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) { break; } @@ -500,7 +499,7 @@ int bbsnet_connect(int n) else { input_buf_len += ret; - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); continue; } } @@ -577,7 +576,9 @@ int bbsnet_connect(int n) } else if (ret == 0) // broken pipe { - log_common("read(socket) EOF\n"); +#ifdef _DEBUG + log_error("read(socket) EOF\n"); +#endif sock_read_wait = 0; loop = 0; break; @@ -629,7 +630,9 @@ int bbsnet_connect(int n) } else if (ret == 0) // broken pipe { - log_common("write(STDOUT) EOF\n"); +#ifdef _DEBUG + log_error("write(STDOUT) EOF\n"); +#endif stdout_write_wait = 0; loop = 0; break; @@ -668,7 +671,7 @@ cleanup: log_error("Close socket failed\n"); } - t_used = time(0) - t_used; + t_used = time(NULL) - t_used; tm_used = gmtime(&t_used); log_common("BBSNET disconnect, %d days %d hours %d minutes %d seconds used\n", @@ -734,7 +737,7 @@ int bbs_net() load_bbsnet_conf(CONF_BBSNET); - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); clearscr(); bbsnet_refresh(); @@ -744,6 +747,12 @@ int bbs_net() while (!SYS_server_exit) { ch = igetch(100); + + if (user_online_update("BBS_NET") < 0) + { + log_error("user_online_update(BBS_NET) error\n"); + } + switch (ch) { case KEY_NULL: // broken pipe @@ -751,7 +760,7 @@ int bbs_net() case Ctrl('C'): // user cancel goto cleanup; case KEY_TIMEOUT: - if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME) + if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) { goto cleanup; } @@ -800,7 +809,7 @@ int bbs_net() bbsnet_selchange(); break; } - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); } cleanup: