示例#1
0
func (this *DaughterHandler) PushToDaughter(packet *structure.Packet) error {
	if packet == nil {
		err := errors.New("component: DaughterHandler.PushToDaughter() failed, got a nil packet as argument")
		fmt.Println(err.Error())
		return err
	}
	//向toDaughter中写入packet
	this.toDaughter <- packet
	statistics.GetToDaughterQueueCount().Add()
	return nil
}
示例#2
0
//从toDaughter通道中接收Packet
func (this *DaughterHandler) ToDaughterPop() *structure.Packet {
	packet := <-this.toDaughter
	//GetToDaughterQueueCount是QueueCount,将Number-1
	statistics.GetToDaughterQueueCount().Dec()
	return packet
}