func (this *Callback) OnClose(c *gotcp.Conn) { log.Println("OnClose:", c.GetExtraData()) addr := c.GetExtraData() this.cm.DelConn(addr) }
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 }