You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
498 B
Go
23 lines
498 B
Go
package plain
|
|
|
|
import (
|
|
"git.noahlan.cn/noahlan/nnet"
|
|
"git.noahlan.cn/noahlan/nnet/connection"
|
|
"git.noahlan.cn/noahlan/nnet/packet"
|
|
)
|
|
|
|
func withPipeline() nnet.RunOption {
|
|
return func(ngin *nnet.Engine) {
|
|
ngin.Pipeline().Inbound().PushFront(func(conn *connection.Connection, v any) error {
|
|
_, ok := v.(*Packet)
|
|
if !ok {
|
|
return packet.ErrWrongPacketType
|
|
}
|
|
if conn.Status() != connection.StatusWorking {
|
|
conn.SetStatus(connection.StatusWorking)
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
}
|