fix: 修复 server.Server 在使用 UseShunt 函数时由于未记录当前分发器导致的内存泄漏问题
This commit is contained in:
@@ -596,6 +596,7 @@ func (slf *Server) UseShunt(conn *Conn, name string) {
|
||||
delete(slf.dispatchers, curr.name)
|
||||
}
|
||||
}
|
||||
slf.currDispatcher[conn.GetID()] = d
|
||||
|
||||
member, exist := slf.dispatcherMember[name]
|
||||
if !exist {
|
||||
|
||||
@@ -24,6 +24,9 @@ func TestNew(t *testing.T) {
|
||||
fmt.Println("关闭", conn.GetID(), err, "Count", srv.GetOnlineCount())
|
||||
})
|
||||
srv.RegConnectionOpenedEvent(func(srv *server.Server, conn *server.Conn) {
|
||||
srv.UseShunt(conn, "1")
|
||||
srv.UseShunt(conn, "2")
|
||||
srv.UseShunt(conn, "3")
|
||||
//if srv.GetOnlineCount() > 1 {
|
||||
// conn.Close()
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user