package plain import ( "git.noahlan.cn/noahlan/nnet/core" "git.noahlan.cn/noahlan/nnet/entity" "git.noahlan.cn/noahlan/nnet/packet" ) func withPipeline() core.RunOption { return func(net *core.NNet) { net.Pipeline().Inbound().PushFront(func(et entity.NetworkEntity, v interface{}) error { _, ok := v.(*Packet) if !ok { return packet.ErrWrongPacketType } if et.Status() != core.StatusWorking { et.SetStatus(core.StatusWorking) } return nil }) } }