//GetToParentQueueCount()返回一个都为空的QueueCount //从sendQueue中接收数据 func (this *ParentHandler) SendQueuePop() *structure.Packet { //接收通道中的Packet packet := <-this.sendQueue //QueueCount数减1 statistics.GetToParentQueueCount().Dec() return packet }
func (this *ParentHandler) SendToParent(packet *structure.Packet) error { if packet == nil { err := errors.New("component: ParentHandler.SendToParent() failed, got a nil pointer") fmt.Println(err.Error()) } //向sendQueue通道中发送packet this.sendQueue <- packet //QueueCount的Number加1 statistics.GetToParentQueueCount().Add() return nil }