Ejemplo n.º 1
0
func (this *DaughterHandler) handleForward(packet *structure.Packet) {
	//	fmt.Println("\n", time.Now().String(), " In DaughterHandler.HandleForWard", "\n")
	statistics.GetForwardCount().AddFromDaughter()
	conn := GetSTree().UserMap.Get(packet.Uuid)
	if conn == nil && GetSTree().Type != "Root" {
		//forward this packet to parent
		//		fmt.Println("Send this Packet to Parent")
		GetParentHandler().SendToParent(packet)
	} else {
		//		fmt.Println("Send this packet to Daughter")
		statistics.GetForwardCount().AddToDaughter()
		this.PushToDaughter(packet)
	}
}
Ejemplo n.º 2
0
func (this *ParentHandler) dispatch(packet *structure.Packet) {
	switch packet.Number {
	case define.FORWARD:
		//GetForwardCount()返回的是ForwardCount,然后将ToDaughter加1
		statistics.GetForwardCount().AddToDaughter()
		GetDaughterHandler().PushToDaughter(packet)
	case define.QUERY_USER_RESPONSE:
		GetDaughterHandler().PushToDaughter(packet)
	case define.ALLOC_SERVER:
		this.handleAllocServer(packet)
	}
}