Ejemplo n.º 1
0
func (this *Callback) OnClose(c *gotcp.Conn) {
	log.Println("OnClose:", c.GetExtraData())

	addr := c.GetExtraData()
	this.cm.DelConn(addr)

}
Ejemplo n.º 2
0
func (this *Callback) OnConnect(c *gotcp.Conn) bool {
	addr := c.GetRawConn().RemoteAddr()
	c.PutExtraData(addr.String())
	//str := addr.String()
	/* act on str */
	this.cm.AddConn(addr.String(), c)

	log.Println("OnConnect:", addr)
	return true
}