gobeetle: remove new known client id from unknown client ids
MODIFY
go/datatypes.go
go/datatypes.go
@@ -35,6 +35,16 @@ func (l *StringList) Add(s string) {
*l = append(*l, s)
}
+// Remove removes given string from string slice l.
+func (l *StringList) Remove(s string) {
+ for i, x := range *l {
+ if x == s {
+ *l = append((*l)[:i], (*l)[i+1:]...)
+ return
+ }
+ }
+}
+
// StringSet implements convenient set abstractions.
type StringSet map[string]bool

MODIFY
go/server_state.go
go/server_state.go
@@ -390,6 +390,7 @@ func (s *ServerState) updateClientIds() {
for _, id := range strings.Split(s.GetConfig().ClientIds, ",") {
if id != "" {
s.clientIds.Add(id)
+ s.unknownClientIds.Remove(id)
}
}
}
@@ -406,8 +407,8 @@ func NewServerState(o ServerOptions) *ServerState {
}
s.wsChannel = make(chan *WsMsg, 10000)
s.cmdChannel = make(chan command, 1000)
- s.updateClientIds()
s.unknownClientIds = make(StringList, 0)
+ s.updateClientIds()
s.clientsLastSeen = make(TimeSet)
s.failovers = make(map[string]*FailoverState)
s.systemNames = make(StringList, 0)

gobeetle: remove new known client id from unknown client ids