⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keepalivedaemon.as

📁 flex实现的前台
💻 AS
字号:
package cn.humanmonth.chat.daemon
{
	import cn.humanmonth.chat.Connector;
	import cn.humanmonth.chat.Protocol;
	
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	/**
	 * @author Piterlin
	 * 每隔六十秒检查一次Connector的保活标志位,看是否需要发送保活信息
	 */
	public class KeepAliveDaemon
	{
		private var protocol:Protocol;
		private var connector:Connector;
		private var timer:Timer;
		public function KeepAliveDaemon(protocol:Protocol,connector:Connector)
		{
			this.protocol=protocol;
			this.connector=connector;
			timer=new Timer(60000,0);
			timer.addEventListener(TimerEvent.TIMER,timerHandler);
			timer.start();
		}

		public function timerHandler(event:TimerEvent):void{
		if(connector.getShouldSendKeepAlive()){
		protocol.sendKeepAliveSignal();
		}else{
		connector.setShouldSendKeepAliveTrue();
		}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -