/[LeafOK_CVS]/lbbs/src/bbs_net.c
ViewVC logotype

Diff of /lbbs/src/bbs_net.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.98 by sysadm, Thu Dec 18 08:20:14 2025 UTC Revision 1.103 by sysadm, Thu Dec 18 11:18:29 2025 UTC
# Line 531  static int bbsnet_connect(int n) Line 531  static int bbsnet_connect(int n)
531          }          }
532          ts_now = ts_begin;          ts_now = ts_begin;
533    
534          while ((ts_now.tv_sec - ts_begin.tv_sec) +          while ((ts_now.tv_sec - ts_begin.tv_sec) * 1000 +
535                                     (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000 / 1000 <                                     (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000 <
536                             REMOTE_CONNECT_TIMEOUT &&                             REMOTE_CONNECT_TIMEOUT * 1000 &&
537                     !sock_connected && !SYS_server_exit)                     !sock_connected && !SYS_server_exit)
538          {          {
539  #ifdef HAVE_SYS_EPOLL_H  #ifdef HAVE_SYS_EPOLL_H
# Line 573  static int bbsnet_connect(int n) Line 573  static int bbsnet_connect(int n)
573                                                           (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000) /                                                           (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000) /
574                                                     REMOTE_CONNECT_TIMEOUT / 10 +                                                     REMOTE_CONNECT_TIMEOUT / 10 +
575                                             1;                                             1;
576                            if (progress < 0)
577                            {
578                                    progress = 0;
579                            }
580                            if (progress > 100)
581                            {
582                                    progress = 100;
583                            }
584    
585                          if (progress > progress_last)                          if (progress > progress_last)
586                          {                          {
# Line 956  static int bbsnet_connect(int n) Line 964  static int bbsnet_connect(int n)
964                  {                  {
965                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
966                          {                          {
967                                    log_debug("User input timeout\n");
968                                  break;                                  break;
969                          }                          }
970                  }                  }
# Line 1313  static int bbsnet_connect(int n) Line 1322  static int bbsnet_connect(int n)
1322          ret = 1; // Normal disconnect          ret = 1; // Normal disconnect
1323          BBS_last_access_tm = time(NULL);          BBS_last_access_tm = time(NULL);
1324          t_used = BBS_last_access_tm - t_begin;          t_used = BBS_last_access_tm - t_begin;
1325          log_common("BBSNET disconnect, %jd days %jd hours %jd minutes %jd seconds used\n",          log_common("BBSNET disconnect, %ld days %ld hours %ld minutes %ld seconds used\n",
1326                             t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60);                             t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60);
1327    
1328  cleanup:  cleanup:
# Line 1364  cleanup: Line 1373  cleanup:
1373    
1374          if (sock != -1 && close(sock) == -1)          if (sock != -1 && close(sock) == -1)
1375          {          {
1376                  log_error("Close socket failed\n");                  log_error("close(socket) error (%d)\n", errno);
1377          }          }
1378    
1379          if (res)          if (res)
# Line 1457  int bbs_net() Line 1466  int bbs_net()
1466                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
1467                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
1468                          {                          {
1469                                  log_error("User input timeout\n");                                  log_debug("User input timeout\n");
1470                                  goto cleanup;                                  goto cleanup;
1471                          }                          }
1472                          continue;                          continue;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1