If you r going to wait response,or block the goroutine in a getty session(tcp conection), task pool can not be null。
func (s *Server) newSession(session getty.Session) error {
var (
ok bool
tcpConn *net.TCPConn
)
// 省略部分代码...
session.SetTaskPool(srvGrpool)
return nil
}
ortherwise,handleTcpPackage() will blocked,led to the response missing
func (s *session) addTask(pkg interface{}) {
f := func() {
s.listener.OnMessage(s, pkg)
s.incReadPkgNum()
}
if s.tPool != nil {
s.tPool.AddTask(f)
return
}
f()
}