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

fix proto merging logic

This commit is contained in:
Darien Raymond 2017-11-27 23:25:43 +01:00
parent 5f91257018
commit 973ce07db9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -2,8 +2,6 @@ package policy
import ( import (
"time" "time"
"github.com/golang/protobuf/proto"
) )
func (s *Second) Duration() time.Duration { func (s *Second) Duration() time.Duration {
@ -11,5 +9,18 @@ func (s *Second) Duration() time.Duration {
} }
func (p *Policy) OverrideWith(another *Policy) { func (p *Policy) OverrideWith(another *Policy) {
proto.Merge(p, another) if another.Timeout != nil {
if another.Timeout.Handshake != nil {
p.Timeout.Handshake = another.Timeout.Handshake
}
if another.Timeout.ConnectionIdle != nil {
p.Timeout.ConnectionIdle = another.Timeout.ConnectionIdle
}
if another.Timeout.UplinkOnly != nil {
p.Timeout.UplinkOnly = another.Timeout.UplinkOnly
}
if another.Timeout.DownlinkOnly != nil {
p.Timeout.DownlinkOnly = another.Timeout.DownlinkOnly
}
}
} }