diff --git a/cmd/stdiscosrv/database.go b/cmd/stdiscosrv/database.go index ce151da3c..92ed45db6 100644 --- a/cmd/stdiscosrv/database.go +++ b/cmd/stdiscosrv/database.go @@ -15,6 +15,7 @@ import ( "sort" "time" + "github.com/syncthing/syncthing/lib/sliceutil" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/storage" "github.com/syndtr/goleveldb/leveldb/util" @@ -352,14 +353,7 @@ func expire(addrs []DatabaseAddress, now int64) []DatabaseAddress { i := 0 for i < len(addrs) { if addrs[i].Expires < now { - // This item is expired. Replace it with the last in the list - // (noop if we are at the last item). - addrs[i] = addrs[len(addrs)-1] - // Wipe the last item of the list to release references to - // strings and stuff. - addrs[len(addrs)-1] = DatabaseAddress{} - // Shorten the slice. - addrs = addrs[:len(addrs)-1] + addrs = sliceutil.RemoveAndZero(addrs, i) continue } i++ diff --git a/cmd/stdiscosrv/database_test.go b/cmd/stdiscosrv/database_test.go index 2596b6b17..14b15059d 100644 --- a/cmd/stdiscosrv/database_test.go +++ b/cmd/stdiscosrv/database_test.go @@ -185,7 +185,7 @@ func TestFilter(t *testing.T) { }, { a: []DatabaseAddress{{Address: "a", Expires: 5}, {Address: "b", Expires: 15}, {Address: "c", Expires: 5}, {Address: "d", Expires: 15}, {Address: "e", Expires: 5}}, - b: []DatabaseAddress{{Address: "d", Expires: 15}, {Address: "b", Expires: 15}}, // gets reordered + b: []DatabaseAddress{{Address: "b", Expires: 15}, {Address: "d", Expires: 15}}, }, } diff --git a/gui/default/index.html b/gui/default/index.html index e9691a02b..5b151cb00 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -871,6 +871,13 @@ +
The number of connections must be a non-negative number.
+When set to more than one on both devices, Syncthing will attempt to establish multiple concurrent connections. If the values differ, the highest will be used. Set to zero to let Syncthing decide.
+The rate limit must be a non-negative number (0: no limit)
The rate limit must be a non-negative number (0: no limit)
+The rate limit is applied to the accumulated traffic of all connections to this device.