Skip to content

attention:session handleTcpPackage() blocked when Getty session taskpool is nil #39

@dk-lockdown

Description

@dk-lockdown

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()
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions