mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 02:18:44 -07:00
lib/connections: Fix race (fixes #4177)
This commit is contained in:
parent
7346113742
commit
9667a0a618
@ -187,7 +187,6 @@ func (t *kcpListener) stunRenewal(listener net.PacketConn) {
|
||||
client := stun.NewClientWithConnection(listener)
|
||||
client.SetSoftwareName("syncthing")
|
||||
|
||||
var uri url.URL
|
||||
var natType stun.NATType
|
||||
var extAddr *stun.Host
|
||||
var err error
|
||||
@ -227,10 +226,12 @@ func (t *kcpListener) stunRenewal(listener net.PacketConn) {
|
||||
|
||||
for {
|
||||
changed := false
|
||||
uri = *t.uri
|
||||
|
||||
uri := *t.uri
|
||||
uri.Host = extAddr.TransportAddr()
|
||||
|
||||
t.mut.Lock()
|
||||
|
||||
if t.address == nil || t.address.String() != uri.String() {
|
||||
l.Infof("%s resolved external address %s (via %s)", t.uri, uri.String(), addr)
|
||||
t.address = &uri
|
||||
|
Loading…
Reference in New Issue
Block a user