Browse Source

修改websocket推送日志

zzj 5 years ago
parent
commit
268e7719c2
3 changed files with 7 additions and 4 deletions
  1. 2 1
      websocket/wsClientMgr.cpp
  2. 1 1
      websocket/wsTimerThread.cpp
  3. 4 2
      znet.cpp

+ 2 - 1
websocket/wsClientMgr.cpp

@@ -63,8 +63,9 @@ namespace YA
 
 	void wsClientMgr::send( const std::string & Cmd, const std::string & Data )
 	{
-		std::lock_guard<std::recursive_mutex> lock( __lock );
+		log_info("send2web:cmd=%s,data=%s",Cmd.c_str(),Data.c_str());
 
+		std::lock_guard<std::recursive_mutex> lock( __lock );
 		for ( size_t i = 0; i < __wsClientList.size() ; i++ )
 		{
 			__wsClientList[i]->send( Cmd, Data );

+ 1 - 1
websocket/wsTimerThread.cpp

@@ -69,7 +69,7 @@ namespace YA
 		  return;
 		__CardPosList.copy( CardPosList );
 		std::string jsCardPos = __jsBuilder.BuildCardPos( CardPosList );
-		log_info("[pos_map]%s",jsCardPos.c_str());
+//		log_info("[pos_map]%s",jsCardPos.c_str());
 		swsClientMgr.send( JSON_CMD_VALUE_PUSH, jsCardPos );
 	}
 

+ 4 - 2
znet.cpp

@@ -226,11 +226,13 @@ struct sock_client:fd_io,client_ex
 
 		m_sync_timer.set<sock_client,&sock_client::on_sync_timeout>(this);
 
-		log_info("检测同步定时器:%s,%d",name,site_sync_freq);
 		if(site_sync)
 		{
 			log_info("启动分站同步定时器:%s,%d",name,site_sync_freq);
-			m_sync_timer.start(0,site_sync_freq);
+			struct timeval tv;
+			gettimeofday(&tv,0);
+
+			m_sync_timer.start(2-tv.tv_usec/1000000.+0.01,site_sync_freq);
 		}
 
 //		m_send_timer.set(ic);