mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 14:58:26 +00:00
Update relay parameters even if it already exists (fixes #3)
This commit is contained in:
parent
ac17b2c584
commit
8b3f5fda07
@ -383,11 +383,17 @@ func requestProcessor() {
|
|||||||
timer.Stop()
|
timer.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, current := range knownRelays {
|
for i, current := range knownRelays {
|
||||||
if current.uri.Host == request.relay.uri.Host {
|
if current.uri.Host == request.relay.uri.Host {
|
||||||
if debug {
|
if debug {
|
||||||
log.Println("Relay", request.relay, "already exists")
|
log.Println("Relay", request.relay, "already exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Evict the old entry anyway, as configuration might have changed.
|
||||||
|
last := len(knownRelays) - 1
|
||||||
|
knownRelays[i] = knownRelays[last]
|
||||||
|
knownRelays = knownRelays[:last]
|
||||||
|
|
||||||
goto found
|
goto found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,9 +401,11 @@ func requestProcessor() {
|
|||||||
if debug {
|
if debug {
|
||||||
log.Println("Adding new relay", request.relay)
|
log.Println("Adding new relay", request.relay)
|
||||||
}
|
}
|
||||||
knownRelays = append(knownRelays, request.relay)
|
|
||||||
|
|
||||||
found:
|
found:
|
||||||
|
|
||||||
|
knownRelays = append(knownRelays, request.relay)
|
||||||
|
|
||||||
evictionTimers[request.relay.uri.Host] = time.AfterFunc(evictionTime, evict(request.relay))
|
evictionTimers[request.relay.uri.Host] = time.AfterFunc(evictionTime, evict(request.relay))
|
||||||
mut.Unlock()
|
mut.Unlock()
|
||||||
request.result <- result{nil, evictionTime}
|
request.result <- result{nil, evictionTime}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user