mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
update predicate syntax
This commit is contained in:
parent
da9f1a8013
commit
f8ad1f4a3e
@ -2,6 +2,14 @@ package predicate
|
|||||||
|
|
||||||
type Predicate func() bool
|
type Predicate func() bool
|
||||||
|
|
||||||
|
func (this Predicate) And(predicate Predicate) Predicate {
|
||||||
|
return All(this, predicate)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this Predicate) Or(predicate Predicate) Predicate {
|
||||||
|
return Any(this, predicate)
|
||||||
|
}
|
||||||
|
|
||||||
func All(predicates ...Predicate) Predicate {
|
func All(predicates ...Predicate) Predicate {
|
||||||
return func() bool {
|
return func() bool {
|
||||||
for _, p := range predicates {
|
for _, p := range predicates {
|
||||||
|
@ -233,7 +233,7 @@ func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr,
|
|||||||
}
|
}
|
||||||
conn.dataUpdater = NewUpdater(
|
conn.dataUpdater = NewUpdater(
|
||||||
conn.interval,
|
conn.interval,
|
||||||
predicate.All(predicate.Not(isTerminating), predicate.Any(conn.sendingWorker.UpdateNecessary, conn.receivingWorker.UpdateNecessary)),
|
predicate.Not(isTerminating).And(predicate.Any(conn.sendingWorker.UpdateNecessary, conn.receivingWorker.UpdateNecessary)),
|
||||||
isTerminating,
|
isTerminating,
|
||||||
conn.updateTask)
|
conn.updateTask)
|
||||||
conn.pingUpdater = NewUpdater(
|
conn.pingUpdater = NewUpdater(
|
||||||
|
Loading…
Reference in New Issue
Block a user