syncthing/lib/connections
greatroar 8265dac127
lib/nat: Fix race condition in Mapping (#8042)
The locking protocol in nat.Mapping was racy:

* Mapping.addressMap RLock'd, but then returned a map shared between
  caller and Mapping, so the lock didn't do anything.

* Operations inside Service.{verifyExistingMappings,acquireNewMappings}
  would lock the map for every update, but that means callers to
  Mapping.ExternalAddresses can be looping over the map while the
  Service methods are concurrently modifying it. When the Go runtime
  detects that happening, it panics.

* Mapping.expires was read and updated without locking.

The Service methods now lock the map once and release the lock only when
done.

Also, subscribers no longer get the added and removed addresses, because
none of them were using the information. This was changed for a previous
attempt to retain the fine-grained locking and not reverted because it
simplifies the code.
2021-11-22 08:29:44 +01:00
..
mocks lib: Use counterfeiter to mock interfaces in tests (#7375) 2021-03-03 08:53:50 +01:00
registry lib/connections: Fix and optimize registry (#7996) 2021-10-06 10:52:51 +02:00
connections_test.go lib/syncthing: Clean up / refactor LoadOrGenerateCertificate() utility function. (#8025) 2021-11-07 23:59:48 +01:00
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
deprecated.go lib/connections: Handle QUIC not being available (#7186) 2020-12-09 19:23:50 +01:00
dialqueue_test.go lib/config, lib/connections: Add optional connection limits (fixes #7176) (#7223) 2021-01-11 15:14:44 +01:00
dialqueue.go lib/config, lib/connections: Add optional connection limits (fixes #7176) (#7223) 2021-01-11 15:14:44 +01:00
lan_test.go all: Refactor preparing configuration (#7127) 2020-11-20 14:21:54 +01:00
limiter_test.go all: Make config.Wrapper an actual suture.Service (fixes #7451) (#7452) 2021-03-11 14:51:00 +01:00
limiter.go all: Use protobuf to generate config structs (fixes #6734) (#6900) 2020-08-25 08:11:14 +02:00
quic_dial.go lib/connections: Fix and optimize registry (#7996) 2021-10-06 10:52:51 +02:00
quic_listen.go lib/connections: Remove future go build constraints on quic (#7898) 2021-08-19 21:05:28 +02:00
quic_misc.go lib/connections: Fix and optimize registry (#7996) 2021-10-06 10:52:51 +02:00
quic_unsupported.go lib/connections: Remove future go build constraints on quic (#7898) 2021-08-19 21:05:28 +02:00
relay_dial.go lib/connections, lib/model: Track last connection duration (ref #7223) (#7242) 2021-01-05 17:45:07 +01:00
relay_listen.go all: Refactor relay invitations (#7646) 2021-05-10 22:25:43 +02:00
service.go lib/connections: Fully dial resumed devices (#7798) 2021-07-03 18:26:55 +02:00
structs.go all: Truncate some timestamps (fixes #7457) (#7459) 2021-03-12 10:35:10 +01:00
tcp_dial.go lib/connections, lib/model: Track last connection duration (ref #7223) (#7242) 2021-01-05 17:45:07 +01:00
tcp_listen.go lib/nat: Fix race condition in Mapping (#8042) 2021-11-22 08:29:44 +01:00
util.go lib/connections: Add connection benchmarks, allow binding to port zero addresses (#7648) 2021-05-10 15:44:47 +01:00