Esempio n. 1
0
/// 新连接到达时回调.
func NewConnCB(sock connector.Socket) {
	fmt.Printf("new connection<id:%v remoteAddr:%v>\n", sock.ID(), sock.RemoteAddress())
}
Esempio n. 2
0
/// 回调函数,当有新连接到来时调用该回调函数,创建并记录session,该回调函数注册给connector使用.
func (cocnct *CoConnector) ConnectionEventCB(sock connector.Socket) *sessionService.Session {
	session := cocnct.cosess.CreateSession(sock.ID(), cocnct.ctx.GetServerID(), sock)
	return session
}