package plain import ( "git.noahlan.cn/noahlan/nnet" "git.noahlan.cn/noahlan/nnet/conn" "git.noahlan.cn/noahlan/nnet/event" "git.noahlan.cn/noahlan/nnet/packet" ) func withEvents() nnet.RunOption { return func(ngin *nnet.Engine) { ngin.EventManager().RegisterEventFront(event.EvtOnReceive, onReceiveEvent()) } } func onReceiveEvent() event.OnReceiveFn { return func(nc *conn.Connection, _ packet.IPacket) { if nc.Status() != conn.StatusWorking { nc.SetStatus(conn.StatusWorking) } } }