@@ -62,6 +62,7 @@ import (
62
62
"os/signal"
63
63
"path/filepath"
64
64
"runtime"
65
+ "sort"
65
66
"strconv"
66
67
"syscall"
67
68
"time"
@@ -75,7 +76,8 @@ import (
75
76
func (kvs * KvService ) connect () error {
76
77
77
78
myIPs , _ := getMyIPs (true )
78
- rlog .Infof ("Cluster: My IPs: %s\n " , getIPsString (myIPs ))
79
+ myIPstrings := getIPsString (myIPs )
80
+ rlog .Infof ("Cluster: My IPs: %s\n " , myIPstrings )
79
81
if kvs .AppConfig .Cluster .Binding != "" {
80
82
tempBinding := kvs .AppConfig .Cluster .Binding
81
83
kvs .AppConfig .Cluster .Binding = ""
@@ -157,7 +159,9 @@ func (kvs *KvService) connect() error {
157
159
for {
158
160
olderThan = 0
159
161
for _ , h := range kvs .Configuration .Hosts {
160
- if h == kvs .AppConfig .Cluster .Binding {
162
+ if sort .Search (len (myIPstrings ), func (i int ) bool { return myIPstrings [i ] == h }) > 0 ||
163
+ h == kvs .AppConfig .Cluster .Binding ||
164
+ net .ParseIP (h ).To4 () == nil {
161
165
continue
162
166
}
163
167
getNodeStatus:
@@ -195,9 +199,6 @@ func (kvs *KvService) connect() error {
195
199
196
200
if status .Instantiated == kvs .AppConfig .Cluster .Service .Instantiated {
197
201
fmt .Println ("[ERROR] Shutting down instance to avoid contention." ) //Will auto restart in swarm
198
- if h == "::1" || h == "127.0.0.1" {
199
- continue
200
- }
201
202
os .Exit (1 )
202
203
}
203
204
if status .Instantiated > kvs .AppConfig .Cluster .Service .Instantiated {
0 commit comments