Browse Source

分站第一次连接10秒超时,后续3秒,可设置
service.recv_timeout_first=10
service.recv_timeout=3

zzj 6 years ago
parent
commit
0cbc90bf83
1 changed files with 5 additions and 4 deletions
  1. 5 4
      znet.cpp

+ 5 - 4
znet.cpp

@@ -23,8 +23,9 @@
 #include "crc.h"
 
 extern config_file config;
-int site_sync=config.get("site_sync",0);//分站时间同步,考虑到双IP双机情况,缺省关闭
-int site_sync_freq=config.get("site_sync.freq",60);//分站时间同步间隔
+static int recv_timeout_first=config.get("service.recv_timeout_first",10);
+static int site_sync_freq=config.get("site_sync.freq",60);//分站时间同步间隔
+static int site_sync=config.get("site_sync",0);//分站时间同步,考虑到双IP双机情况,缺省关闭
 struct client_ex:client
 {
 	virtual void on_notify()=0;
@@ -218,7 +219,7 @@ struct sock_client:fd_io,client_ex
 
 //		m_recv_timer.set(ic);
 		m_recv_timer.set<sock_client,&sock_client::on_recv_timeout>(this);
-		m_recv_timer.start(recv_time_out,0);
+		m_recv_timer.start(recv_timeout_first,0);
 
 		m_sync_timer.set<sock_client,&sock_client::on_sync_timeout>(this);
 		if(site_sync)
@@ -565,7 +566,7 @@ struct sock_listen: fd_io
 {
 	sock_listen(io_context&ic,int fd):fd_io(ic,fd){}
 
-	int recv_time_out=config.get("service.recv_timeout",10);
+	int recv_time_out=config.get("service.recv_timeout",3);
 	int max_package_size=config.get("service.max_package",2048);
 
 	void operator()(ev::io &w, int)