Example #1
0
func NewAgant(conn net.Conn, msgParser msg.MsgParser) network.TCPAgent {
	agent := new(agent)
	agent.conn = conn
	agent.msgParser = msgParser.Clone()
	agent.prompt = []byte(">")
	return agent
}
Example #2
0
func NewAgent(conn net.Conn, msgParser msg.MsgParser) network.TCPAgent {
	agent := new(gateway_agent)
	agent.conn = conn
	agent.msgParser = msgParser.Clone()
	agent.lastCheckSpeedSec = time.Now().Unix()
	agent.pk = proto.NewWriter()
	agent.exitCnt = make(chan struct{})
	logger.Debug("socket:%v", conn.RemoteAddr())
	return agent
}