1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

update predicate syntax

This commit is contained in:
Darien Raymond 2016-10-11 12:44:17 +02:00
parent da9f1a8013
commit f8ad1f4a3e
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,14 @@ package predicate
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 {
return func() bool {
for _, p := range predicates {

View File

@ -233,7 +233,7 @@ func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr,
}
conn.dataUpdater = NewUpdater(
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,
conn.updateTask)
conn.pingUpdater = NewUpdater(