Преглед на файлове

fix proto merging logic

Darien Raymond преди 8 години
родител
ревизия
973ce07db9
променени са 1 файла, в които са добавени 14 реда и са изтрити 3 реда
  1. 14 3
      app/policy/config.go

+ 14 - 3
app/policy/config.go

@@ -2,8 +2,6 @@ package policy
 
 import (
 	"time"
-
-	"github.com/golang/protobuf/proto"
 )
 
 func (s *Second) Duration() time.Duration {
@@ -11,5 +9,18 @@ func (s *Second) Duration() time.Duration {
 }
 
 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
+		}
+	}
 }