/[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.55 by sysadm, Sat Jun 21 02:15:18 2025 UTC Revision 1.58 by sysadm, Wed Oct 1 02:20:50 2025 UTC
# Line 213  int bbsnet_connect(int n) Line 213  int bbsnet_connect(int n)
213          int tos;          int tos;
214          char remote_addr[IP_ADDR_LEN];          char remote_addr[IP_ADDR_LEN];
215          int remote_port;          int remote_port;
216          time_t t_used;          time_t t_used = time(NULL);
217          struct tm *tm_used;          struct tm *tm_used;
218          int ch;          int ch;
219    
# Line 225  int bbsnet_connect(int n) Line 225  int bbsnet_connect(int n)
225          clearscr();          clearscr();
226    
227          moveto(0, 0);          moveto(0, 0);
228          prints("\033[1;32m正在测试往 %s (%s) 的连接,请稍候... \033[m\r\n",          prints("\033[1;32m姝e湪娴嬭瘯寰 %s (%s) 鐨勮繛鎺ワ紝璇风◢鍊... \033[m\r\n",
229                     bbsnet_conf[n].host1, bbsnet_conf[n].ip);                     bbsnet_conf[n].host1, bbsnet_conf[n].ip);
230          iflush();          iflush();
231    
# Line 233  int bbsnet_connect(int n) Line 233  int bbsnet_connect(int n)
233    
234          if (p_host == NULL)          if (p_host == NULL)
235          {          {
236                  prints("\033[1;31m查找主机名失败!\033[m\r\n");                  prints("\033[1;31m鏌ユ壘涓绘満鍚嶅け璐ワ紒\033[m\r\n");
237                  press_any_key();                  press_any_key();
238                  return -1;                  return -1;
239          }          }
# Line 242  int bbsnet_connect(int n) Line 242  int bbsnet_connect(int n)
242    
243          if (sock < 0)          if (sock < 0)
244          {          {
245                  prints("\033[1;31m无法创建socket!\033[m\r\n");                  prints("\033[1;31m鏃犳硶鍒涘缓socket锛乗033[m\r\n");
246                  press_any_key();                  press_any_key();
247                  return -1;                  return -1;
248          }          }
# Line 267  int bbsnet_connect(int n) Line 267  int bbsnet_connect(int n)
267          remote_addr[sizeof(remote_addr) - 1] = '\0';          remote_addr[sizeof(remote_addr) - 1] = '\0';
268          remote_port = ntohs(sin.sin_port);          remote_port = ntohs(sin.sin_port);
269    
270          prints("\033[1;32m穿梭进度条提示您当前已使用的时间,按\033[1;33mCtrl+C\033[1;32m中断。\033[m\r\n");          prints("\033[1;32m绌挎杩涘害鏉℃彁绀烘偍褰撳墠宸蹭娇鐢ㄧ殑鏃堕棿锛屾寜\033[1;33mCtrl+C\033[1;32m涓柇銆俓033[m\r\n");
271          process_bar(0, MAX_PROCESS_BAR_LEN);          process_bar(0, MAX_PROCESS_BAR_LEN);
272    
273          // Set socket as non-blocking          // Set socket as non-blocking
# Line 322  int bbsnet_connect(int n) Line 322  int bbsnet_connect(int n)
322                          {                          {
323                                  log_error("connect(socket) error (%d)\n", errno);                                  log_error("connect(socket) error (%d)\n", errno);
324    
325                                  prints("\033[1;31m连接失败!\033[m\r\n");                                  prints("\033[1;31m杩炴帴澶辫触锛乗033[m\r\n");
326                                  press_any_key();                                  press_any_key();
327    
328                                  goto cleanup;                                  goto cleanup;
# Line 380  int bbsnet_connect(int n) Line 380  int bbsnet_connect(int n)
380          }          }
381          if (!sock_connected)          if (!sock_connected)
382          {          {
383                  prints("\033[1;31m连接失败!\033[m\r\n");                  prints("\033[1;31m杩炴帴澶辫触锛乗033[m\r\n");
384                  press_any_key();                  press_any_key();
385    
386                  goto cleanup;                  goto cleanup;
# Line 392  int bbsnet_connect(int n) Line 392  int bbsnet_connect(int n)
392                  log_error("setsockopt IP_TOS=%d error (%d)\n", tos, errno);                  log_error("setsockopt IP_TOS=%d error (%d)\n", tos, errno);
393          }          }
394    
395          prints("\033[1;31m连接成功!\033[m\r\n");          prints("\033[1;31m杩炴帴鎴愬姛锛乗033[m\r\n");
396          iflush();          iflush();
397          log_common("BBSNET connect to %s:%d\n", remote_addr, remote_port);          log_common("BBSNET connect to %s:%d\n", remote_addr, remote_port);
398    
# Line 507  int bbsnet_connect(int n) Line 507  int bbsnet_connect(int n)
507                                          {                                          {
508                                                  input_buf_len += ret;                                                  input_buf_len += ret;
509                                                  BBS_last_access_tm = time(NULL);                                                  BBS_last_access_tm = time(NULL);
510    
511                                                    // Refresh current action while user input
512                                                    if (user_online_update("BBS_NET") < 0)
513                                                    {
514                                                            log_error("user_online_update(BBS_NET) error\n");
515                                                    }
516    
517                                                  continue;                                                  continue;
518                                          }                                          }
519                                  }                                  }
# Line 708  bbsnet_refresh() Line 715  bbsnet_refresh()
715          moveto(22, 0);          moveto(22, 0);
716          prints(" ----------------------------------------------------------------------------- ");          prints(" ----------------------------------------------------------------------------- ");
717          moveto(23, 0);          moveto(23, 0);
718          prints(" [\x1b[1;32mCtrl+C\x1b[m]退出");          prints(" [\x1b[1;32mCtrl+C\x1b[m]閫鍑");
719    
720          iflush();          iflush();
721    
# Line 721  int bbsnet_selchange() Line 728  int bbsnet_selchange()
728    
729          moveto(20, 0);          moveto(20, 0);
730          clrtoeol();          clrtoeol();
731          prints("|\x1b[1m单位:\x1b[1;33m%-18s\x1b[m  站名:\x1b[1;33m%s\x1b[m",          prints("|\x1b[1m鍗曚綅:\x1b[1;33m%-18s\x1b[m  绔欏悕:\x1b[1;33m%s\x1b[m",
732                     bbsnet_conf[i].host2, bbsnet_conf[i].host1);                     bbsnet_conf[i].host2, bbsnet_conf[i].host1);
733          moveto(20, 79);          moveto(20, 79);
734          prints("|");          prints("|");
735          moveto(21, 0);          moveto(21, 0);
736          clrtoeol();          clrtoeol();
737          prints("|\x1b[1m连往:\x1b[1;33m%-20s", bbsnet_conf[i].ip);          prints("|\x1b[1m杩炲線:\x1b[1;33m%-20s", bbsnet_conf[i].ip);
738          if (bbsnet_conf[i].port != 23)          if (bbsnet_conf[i].port != 23)
739          {          {
740                  prints("  %d", bbsnet_conf[i].port);                  prints("  %d", bbsnet_conf[i].port);


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

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