#pragma once

class master_service : public acl::master_threads
{
public:
	master_service();
	~master_service();

protected:
	/**
	 * 麯ĳͻݿɶرջʱô˺
	 * @param stream {socket_stream*}
	 * @return {bool}  false ʾغҪرӣ
	 *  ʾҪֳӣӦӦ÷ false
	 */
	virtual bool thread_on_read(acl::socket_stream* stream);

	/**
	 * ̳߳еĳ̻߳һʱĻص
	 * һЩʼ
	 * @param stream {socket_stream*}
	 * @return {bool}  false ʾҪرӣ
	 *  ؽٴ thread_main 
	 */
	virtual bool thread_on_accept(acl::socket_stream* stream);

	/**
	 * ĳӵ IO дʱʱĻصú true ʾȴһ
	 * дϣرո
	 * @param stream {socket_stream*}
	 * @return {bool}  false ʾҪرӣ
	 *  ؽٴ thread_main 
	 */
	virtual bool thread_on_timeout(acl::socket_stream* stream);

	/**
	 * ĳ̰߳󶨵ӹرʱĻص
	 * @param stream {socket_stream*}
	 */
	virtual void thread_on_close(acl::socket_stream* stream);

	/**
	 * ̳߳һ̱߳ʱĻص
	 */
	virtual void thread_on_init();

	/**
	 * ̳߳һ߳˳ʱĻص
	 */
	virtual void thread_on_exit();

	/**
	 * лûݺõĻص˺ʱ
	 * ȨΪͨ޼
	 */
	virtual void proc_on_init();

	/**
	 * ˳ǰõĻص
	 */
	virtual void proc_on_exit();

private:
	acl::event_timer* status_timer_;
};
