Ver Fonte

Merge pull request #1609 from aboch/gw46

Prioritize nw endpoint which can provide both v4 and v6 connectivity
Santhosh Manohar há 8 anos atrás
pai
commit
5c4fcff5bc
1 ficheiros alterados com 11 adições e 0 exclusões
  1. 11 0
      libnetwork/sandbox.go

+ 11 - 0
libnetwork/sandbox.go

@@ -1174,6 +1174,17 @@ func (eh epHeap) Less(i, j int) bool {
 		return true
 	}
 
+	if epi.joinInfo != nil && epj.joinInfo != nil {
+		if (epi.joinInfo.gw != nil && epi.joinInfo.gw6 != nil) &&
+			(epj.joinInfo.gw == nil || epj.joinInfo.gw6 == nil) {
+			return true
+		}
+		if (epj.joinInfo.gw != nil && epj.joinInfo.gw6 != nil) &&
+			(epi.joinInfo.gw == nil || epi.joinInfo.gw6 == nil) {
+			return false
+		}
+	}
+
 	if ci != nil {
 		cip, ok = ci.epPriority[eh[i].ID()]
 		if !ok {