From 0b193b76c25d88af72f2f6e3565a73762d8cf301 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 11 Jan 2021 15:14:44 +0100 Subject: [PATCH] lib/config, lib/connections: Add optional connection limits (fixes #7176) (#7223) This adds two new configuration options: // The number of connections at which we stop trying to connect to more // devices, zero meaning no limit. Does not affect incoming connections. ConnectionLimitEnough int // The maximum number of connections which we will allow in total, zero // meaning no limit. Affects incoming connections and prevents // attempting outgoing connections. ConnectionLimitMax int These can be used to limit the number of concurrent connections in various ways. --- go.mod | 2 +- lib/api/mocked_model_test.go | 6 +- lib/config/observed.pb.go | 2 +- lib/config/optionsconfiguration.go | 22 + lib/config/optionsconfiguration.pb.go | 465 +++++++++++--------- lib/connections/dialqueue.go | 54 +++ lib/connections/dialqueue_test.go | 119 +++++ lib/connections/service.go | 60 ++- lib/connections/structs.go | 3 + lib/db/structs.pb.go | 2 +- lib/model/model.go | 28 +- lib/model/model_test.go | 2 +- proto/lib/config/optionsconfiguration.proto | 8 + 13 files changed, 555 insertions(+), 218 deletions(-) create mode 100644 lib/connections/dialqueue.go create mode 100644 lib/connections/dialqueue_test.go diff --git a/go.mod b/go.mod index db38ce318..e7c68ea0f 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/gobwas/glob v0.2.3 github.com/gogo/protobuf v1.3.1 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e - github.com/golang/protobuf v1.4.3 github.com/greatroar/blobloom v0.5.0 github.com/jackpal/gateway v1.0.6 github.com/jackpal/go-nat-pmp v1.0.2 @@ -46,6 +45,7 @@ require ( golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 golang.org/x/text v0.3.4 golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e + google.golang.org/protobuf v1.23.0 ) go 1.14 diff --git a/lib/api/mocked_model_test.go b/lib/api/mocked_model_test.go index 0272a2b1e..8d73bbc52 100644 --- a/lib/api/mocked_model_test.go +++ b/lib/api/mocked_model_test.go @@ -49,11 +49,15 @@ func (m *mockedModel) FolderProgressBytesCompleted(_ string) int64 { return 0 } +func (m *mockedModel) NumConnections() int { + return 0 +} + func (m *mockedModel) ConnectionStats() map[string]interface{} { return nil } -func (m *mockedModel) DeviceStatistics() (map[string]stats.DeviceStatistics, error) { +func (m *mockedModel) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) { return nil, nil } diff --git a/lib/config/observed.pb.go b/lib/config/observed.pb.go index e345e58ec..d997d3755 100644 --- a/lib/config/observed.pb.go +++ b/lib/config/observed.pb.go @@ -7,9 +7,9 @@ import ( fmt "fmt" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/timestamp" github_com_syncthing_syncthing_lib_protocol "github.com/syncthing/syncthing/lib/protocol" _ "github.com/syncthing/syncthing/proto/ext" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" diff --git a/lib/config/optionsconfiguration.go b/lib/config/optionsconfiguration.go index e7e5bab80..c3ac282e6 100644 --- a/lib/config/optionsconfiguration.go +++ b/lib/config/optionsconfiguration.go @@ -47,6 +47,14 @@ func (opts *OptionsConfiguration) prepare(guiPWIsSet bool) { } } } + + // Negative limits are meaningless, zero means unlimited. + if opts.ConnectionLimitEnough < 0 { + opts.ConnectionLimitEnough = 0 + } + if opts.ConnectionLimitMax < 0 { + opts.ConnectionLimitMax = 0 + } } // RequiresRestartOnly returns a copy with only the attributes that require @@ -178,3 +186,17 @@ func (opts OptionsConfiguration) FeatureFlag(name string) bool { return false } + +// LowestConnectionLimit is the lower of ConnectionLimitEnough or +// ConnectionLimitMax, or whichever of them is actually set if only one of +// them is set. It's the point where we should stop dialling. +func (opts OptionsConfiguration) LowestConnectionLimit() int { + limit := opts.ConnectionLimitEnough + if limit == 0 || (opts.ConnectionLimitMax != 0 && opts.ConnectionLimitMax < limit) { + // It doesn't really make sense to set Max lower than Enough but + // someone might do it while experimenting and it's easy for us to + // do the right thing. + limit = opts.ConnectionLimitMax + } + return limit +} diff --git a/lib/config/optionsconfiguration.pb.go b/lib/config/optionsconfiguration.pb.go index 9224c6aec..c02a51596 100644 --- a/lib/config/optionsconfiguration.pb.go +++ b/lib/config/optionsconfiguration.pb.go @@ -74,6 +74,13 @@ type OptionsConfiguration struct { AnnounceLANAddresses bool `protobuf:"varint,48,opt,name=announce_lan_addresses,json=announceLanAddresses,proto3" json:"announceLANAddresses" xml:"announceLANAddresses" default:"true"` SendFullIndexOnUpgrade bool `protobuf:"varint,49,opt,name=send_full_index_on_upgrade,json=sendFullIndexOnUpgrade,proto3" json:"sendFullIndexOnUpgrade" xml:"sendFullIndexOnUpgrade"` FeatureFlags []string `protobuf:"bytes,50,rep,name=feature_flags,json=featureFlags,proto3" json:"featureFlags" xml:"featureFlag"` + // The number of connections at which we stop trying to connect to more + // devices, zero meaning no limit. Does not affect incoming connections. + ConnectionLimitEnough int `protobuf:"varint,51,opt,name=connection_limit_enough,json=connectionLimitEnough,proto3,casttype=int" json:"connectionLimitEnough" xml:"connectionLimitEnough"` + // The maximum number of connections which we will allow in total, zero + // meaning no limit. Affects incoming connections and prevents + // attempting outgoing connections. + ConnectionLimitMax int `protobuf:"varint,52,opt,name=connection_limit_max,json=connectionLimitMax,proto3,casttype=int" json:"connectionLimitMax" xml:"connectionLimitMax"` // Legacy deprecated DeprecatedUPnPEnabled bool `protobuf:"varint,9000,opt,name=upnp_enabled,json=upnpEnabled,proto3" json:"-" xml:"upnpEnabled,omitempty"` // Deprecated: Do not use. DeprecatedUPnPLeaseM int `protobuf:"varint,9001,opt,name=upnp_lease_m,json=upnpLeaseM,proto3,casttype=int" json:"-" xml:"upnpLeaseMinutes,omitempty"` // Deprecated: Do not use. @@ -126,204 +133,208 @@ func init() { } var fileDescriptor_d09882599506ca03 = []byte{ - // 3138 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 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0x2b, 0x79, 0x07, 0x73, 0xa0, - 0xe6, 0xaa, 0x7d, 0x1e, 0x89, 0x0e, 0x67, 0x97, 0x9a, 0x3b, 0x78, 0x8b, 0x04, 0x2d, 0x5d, 0xe7, - 0x53, 0x36, 0x0b, 0xe4, 0x63, 0xf0, 0x2e, 0x7d, 0x8d, 0x43, 0x29, 0xf9, 0x82, 0xbc, 0xeb, 0x21, - 0x5d, 0x34, 0xa0, 0x7d, 0x43, 0x51, 0x87, 0x70, 0xc0, 0x5c, 0x33, 0x68, 0x6d, 0x78, 0xb8, 0x4e, - 0xb2, 0x64, 0x68, 0x53, 0x7f, 0x9c, 0x0f, 0xe4, 0x0a, 0x94, 0x5c, 0xa0, 0xb2, 0x1e, 0x69, 0x24, - 0x79, 0xc4, 0x2b, 0x69, 0x75, 0x22, 0x03, 0xc5, 0xe1, 0x9b, 0x14, 0x33, 0xc3, 0x89, 0x49, 0x24, - 0xb5, 0xa6, 0x35, 0xd5, 0xa1, 0x84, 0x03, 0x73, 0xcd, 0x96, 0x07, 0x53, 0xcc, 0xcf, 0x62, 0x5f, - 0xbf, 0xcc, 0x07, 0xe0, 0x16, 0x10, 0x89, 0x55, 0xd6, 0xdc, 0x15, 0x8f, 0xa0, 0x18, 0xef, 0x84, - 0xc6, 0xe5, 0x68, 0x0a, 0x25, 0x60, 0x05, 0x49, 0xdb, 0x68, 0xdb, 0xaa, 0xb6, 0x45, 0x48, 0xcb, - 0x64, 0xa4, 0xd9, 0x72, 0x3d, 0xec, 0xd9, 0xc4, 0x37, 0x37, 0xf5, 0x2b, 0xdc, 0xe5, 0x57, 0x60, - 0x23, 0x00, 0xba, 0x96, 0x81, 0xe0, 0xee, 0x35, 0xde, 0x4b, 0x11, 0x10, 0x6b, 0xb1, 0x17, 0x45, - 0x57, 0x27, 0x5f, 0x44, 0x25, 0x2b, 0xda, 0x9e, 0xda, 0x6f, 0x61, 0x6b, 0x93, 0x98, 0xf6, 0x06, - 0x75, 0x3d, 0x52, 0x37, 0x1b, 0xb6, 0x43, 0x7c, 0xfd, 0x2a, 0x77, 0x71, 0x01, 0x4e, 0x34, 0x0e, - 0x2f, 0x44, 0xe8, 0x3c, 0x80, 0xe9, 0x40, 0x97, 0x90, 0xd2, 0x1e, 0x4c, 0xf7, 0x16, 0x2a, 0x9b, - 0xd1, 0xbe, 0xa3, 0xa8, 0x97, 0x5b, 0x9e, 0xbb, 0x01, 0xc5, 0x8c, 0x19, 0xb4, 0xea, 0x98, 0x11, - 0xb1, 0x40, 0x78, 0x82, 0xfb, 0xbe, 0x06, 0xf9, 0x6d, 0xa2, 0xb5, 0xce, 0x95, 0xc4, 0x62, 0x20, - 0x2a, 0xb2, 0xbb, 0xe0, 0x02, 0x9d, 0x97, 0x84, 0x81, 0x50, 0x5e, 0x42, 0xdd, 0x2c, 0x6a, 0x6f, - 0x2b, 0xea, 0xa0, 0x63, 0x37, 0x6d, 0x66, 0xd6, 0x30, 0xad, 0xef, 0xd8, 0x75, 0xb6, 0x69, 0xda, - 0xd4, 0x74, 0x30, 0xd5, 0x87, 0xf9, 0x90, 0x2c, 0xf1, 0xe2, 0x11, 0x34, 0x66, 0x12, 0x85, 0x05, - 0xba, 0x88, 0x69, 0x56, 0xf0, 0x97, 0xb1, 0x4f, 0x18, 0x16, 0x99, 0x29, 0xed, 0x2d, 0x45, 0xd5, - 0x9a, 0x36, 0x35, 0x37, 0xdd, 0x26, 0x31, 0xeb, 0xb6, 0xbf, 0x65, 0x36, 0x3c, 0x42, 0x74, 0x63, - 0x44, 0x19, 0x3d, 0x37, 0xd9, 0x73, 0x23, 0xba, 0x59, 0xbb, 0xb1, 0x6a, 0xbf, 0x41, 0x66, 0x5e, - 0xfe, 0x20, 0x34, 0x4e, 0xc0, 0x4e, 0x6c, 0xda, 0xf4, 0x15, 0xb7, 0x49, 0xe6, 0x6c, 0x7f, 0x6b, - 0xde, 0x23, 0x24, 0x5d, 0x1d, 0x05, 0xb9, 0xb8, 0x0f, 0x46, 0xae, 0x03, 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0x6e, 0x73, 0x2c, 0xcd, 0xe7, 0x84, 0x5f, 0xd9, 0xbf, 0x79, 0x6a, 0x67, - 0xf8, 0xdf, 0x77, 0x6e, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x64, 0xe8, 0xf8, 0x5e, 0x2a, 0x24, - 0x00, 0x00, + // 3211 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x5a, 0x5b, 0x6c, 0xdc, 0xc6, + 0xd5, 0x36, 0xed, 0xd8, 0x89, 0x69, 0x59, 0xb6, 0x28, 0x59, 0x62, 0x6c, 0x47, 0x54, 0xd6, 0xeb, + 0x44, 0xb9, 0xd9, 0x92, 0xec, 0xf8, 0x77, 0x0c, 0xfc, 0xc8, 0xaf, 0x4b, 0xf4, 0x5b, 0xb1, 0x64, + 0x0b, 0x23, 0x09, 0xf9, 0x91, 0x1f, 0x05, 0x31, 0xcb, 0x9d, 0x95, 0x58, 0x71, 0x87, 0x6b, 0x72, + 0xa8, 0x95, 0xd2, 0x22, 0x0d, 0x52, 0xf4, 0xf2, 0xd6, 0x56, 0xe8, 0x05, 0x68, 0x81, 0x22, 0x45, + 0x5b, 0xa0, 0x69, 0x9a, 0xa2, 0x40, 0x81, 0x02, 0xed, 0x4b, 0x8b, 0x02, 0x05, 0x82, 0x16, 0xa8, + 0xf4, 0x58, 0xa0, 0x29, 0x8b, 0xc8, 0x79, 0xda, 0x87, 0x3e, 0xec, 0xa3, 0xfa, 0x52, 0x9c, 0xe1, + 0x6d, 0x48, 0xce, 0xc6, 0x7e, 0x5b, 0x9e, 0xef, 0xcc, 0x99, 0xef, 0xcc, 0xe5, 0xcc, 0x39, 0x33, + 0xab, 0x5e, 0x76, 0xec, 0xda, 0x55, 0xcb, 0xa5, 0x0d, 0x7b, 0xfd, 0xaa, 0xdb, 0x62, 0xb6, 0x4b, + 0xfd, 0xe8, 0x2b, 0xf0, 0x30,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x78, 0x9a, 0xbb, 0x23, + 0x0a, 0x7b, 0x8e, 0x74, 0xae, 0xa9, 0xf6, 0x53, 0x45, 0x3d, 0x47, 0x31, 0x33, 0x99, 0x87, 0xe1, + 0x54, 0xc3, 0x4e, 0x3a, 0xb1, 0xfd, 0xbc, 0xb3, 0xfb, 0x07, 0xa1, 0xa1, 0xde, 0x9d, 0x5e, 0xcd, + 0xc2, 0xba, 0x4a, 0x31, 0xcb, 0xe6, 0xd8, 0xe0, 0x1d, 0x67, 0x22, 0x49, 0x08, 0x17, 0x1b, 0xe4, + 0xbe, 0x84, 0x70, 0x2d, 0x74, 0x81, 0x06, 0x29, 0x66, 0xab, 0x09, 0x9d, 0x64, 0x41, 0xfc, 0xae, + 0xc4, 0xd3, 0x21, 0xd8, 0x27, 0x66, 0x53, 0x3f, 0xc3, 0x97, 0xc2, 0x57, 0x61, 0x29, 0x9c, 0xbc, + 0x3b, 0xbd, 0xba, 0x08, 0x62, 0x98, 0xfc, 0x33, 0x14, 0xb3, 0xe8, 0xc3, 0xa6, 0x01, 0xe3, 0xc9, + 0x4f, 0x25, 0x21, 0x2b, 0xca, 0xa5, 0x7b, 0xa3, 0xb3, 0x57, 0x2d, 0xb5, 0x2f, 0x8b, 0xd2, 0x1d, + 0x94, 0x75, 0x8c, 0x34, 0x91, 0x7d, 0x24, 0xd3, 0xfe, 0xac, 0xa8, 0x23, 0x79, 0xf2, 0x1e, 0xa1, + 0xa4, 0xcd, 0x57, 0xf2, 0x59, 0x4e, 0x7f, 0x17, 0xe8, 0x9f, 0xba, 0x3b, 0xbd, 0x8a, 0x22, 0x00, + 0x1c, 0x18, 0xa0, 0x98, 0x25, 0x9f, 0xa9, 0x0b, 0xd5, 0xc4, 0x85, 0x3c, 0x22, 0x38, 0x71, 0x4d, + 0x74, 0x42, 0x62, 0x43, 0x26, 0x04, 0x47, 0xae, 0x81, 0x23, 0x22, 0x05, 0x34, 0x24, 0xba, 0x92, + 0x48, 0x25, 0xce, 0x30, 0x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x85, 0x7e, 0x04, 0xc4, 0xe7, 0x17, 0x15, 0xe5, 0x3b, 0x02, + 0xb3, 0x65, 0x31, 0xfd, 0x43, 0x18, 0x22, 0x65, 0x66, 0xe9, 0x20, 0x34, 0x2e, 0x66, 0x3d, 0x2e, + 0xe5, 0x2b, 0xfc, 0x65, 0x8b, 0xe5, 0xc7, 0xa9, 0x59, 0xc2, 0xf3, 0xdd, 0x6b, 0x65, 0x05, 0xc8, + 0x10, 0x86, 0x0a, 0xe7, 0xa3, 0x6f, 0x61, 0xea, 0xeb, 0xbf, 0x8c, 0x66, 0x69, 0xb5, 0x40, 0x41, + 0x3c, 0x57, 0x56, 0x40, 0xb1, 0x40, 0xa1, 0x84, 0x97, 0xa7, 0x8a, 0x33, 0x29, 0xe9, 0xcd, 0xdc, + 0xf9, 0xe8, 0x93, 0xd1, 0x23, 0xfb, 0x9f, 0x8c, 0x1e, 0xf9, 0xe8, 0x60, 0x54, 0xd9, 0x3f, 0x18, + 0x55, 0xbe, 0xf9, 0x60, 0xf4, 0xc8, 0x7b, 0x0f, 0x46, 0x95, 0xfd, 0x07, 0xa3, 0x47, 0xfe, 0xf6, + 0x60, 0xf4, 0xc8, 0x9b, 0xcf, 0xad, 0xdb, 0x6c, 0x23, 0xa8, 0x5d, 0xb1, 0xdc, 0xe6, 0xd5, 0x34, + 0x6b, 0x15, 0x7e, 0x65, 0xff, 0x59, 0xaa, 0x9d, 0xe0, 0x7f, 0x52, 0xba, 0xf6, 0x9f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x43, 0x37, 0xb7, 0x54, 0x10, 0x25, 0x00, 0x00, } func (m *OptionsConfiguration) Marshal() (dAtA []byte, err error) { @@ -419,6 +430,20 @@ func (m *OptionsConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xc0 } + if m.ConnectionLimitMax != 0 { + i = encodeVarintOptionsconfiguration(dAtA, i, uint64(m.ConnectionLimitMax)) + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xa0 + } + if m.ConnectionLimitEnough != 0 { + i = encodeVarintOptionsconfiguration(dAtA, i, uint64(m.ConnectionLimitEnough)) + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0x98 + } if len(m.FeatureFlags) > 0 { for iNdEx := len(m.FeatureFlags) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.FeatureFlags[iNdEx]) @@ -1040,6 +1065,12 @@ func (m *OptionsConfiguration) ProtoSize() (n int) { n += 2 + l + sovOptionsconfiguration(uint64(l)) } } + if m.ConnectionLimitEnough != 0 { + n += 2 + sovOptionsconfiguration(uint64(m.ConnectionLimitEnough)) + } + if m.ConnectionLimitMax != 0 { + n += 2 + sovOptionsconfiguration(uint64(m.ConnectionLimitMax)) + } if m.DeprecatedUPnPEnabled { n += 4 } @@ -2218,6 +2249,44 @@ func (m *OptionsConfiguration) Unmarshal(dAtA []byte) error { } m.FeatureFlags = append(m.FeatureFlags, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 51: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionLimitEnough", wireType) + } + m.ConnectionLimitEnough = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOptionsconfiguration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConnectionLimitEnough |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 52: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionLimitMax", wireType) + } + m.ConnectionLimitMax = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOptionsconfiguration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConnectionLimitMax |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } case 9000: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedUPnPEnabled", wireType) diff --git a/lib/connections/dialqueue.go b/lib/connections/dialqueue.go new file mode 100644 index 000000000..0414b7fbd --- /dev/null +++ b/lib/connections/dialqueue.go @@ -0,0 +1,54 @@ +// Copyright (C) 2021 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +package connections + +import ( + "sort" + "time" + + "github.com/syncthing/syncthing/lib/protocol" + "github.com/syncthing/syncthing/lib/rand" +) + +type dialQueueEntry struct { + id protocol.DeviceID + lastSeen time.Time + shortLived bool + targets []dialTarget +} + +type dialQueue []dialQueueEntry + +func (queue dialQueue) Sort() { + // Sort the queue with the most recently seen device at the head, + // increasing the likelihood of connecting to a device that we're + // already almost up to date with, index wise. + sort.Slice(queue, func(a, b int) bool { + qa, qb := queue[a], queue[b] + if qa.shortLived != qb.shortLived { + return qb.shortLived + } + return qa.lastSeen.After(qb.lastSeen) + }) + + // Shuffle the part of the connection queue that are devices we haven't + // connected to recently, so that if we only try a limited set of + // devices (or they in turn have limits and we're trying to load balance + // over several) and the usual ones are down it won't be the same ones + // in the same order every time. + idx := 0 + cutoff := time.Now().Add(-recentlySeenCutoff) + for idx < len(queue) { + if queue[idx].lastSeen.Before(cutoff) { + break + } + idx++ + } + if idx < len(queue)-1 { + rand.Shuffle(queue[idx:]) + } +} diff --git a/lib/connections/dialqueue_test.go b/lib/connections/dialqueue_test.go new file mode 100644 index 000000000..2a0ddd268 --- /dev/null +++ b/lib/connections/dialqueue_test.go @@ -0,0 +1,119 @@ +// Copyright (C) 2021 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +package connections + +import ( + "reflect" + "testing" + "time" + + "github.com/syncthing/syncthing/lib/protocol" +) + +func TestDialQueueSort(t *testing.T) { + t.Parallel() + + t.Run("ByLastSeen", func(t *testing.T) { + t.Parallel() + + // Devices seen within the last week or so should be sorted stricly in order. + now := time.Now() + queue := dialQueue{ + {id: device1, lastSeen: now.Add(-5 * time.Hour)}, // 1 + {id: device2, lastSeen: now.Add(-50 * time.Hour)}, // 3 + {id: device3, lastSeen: now.Add(-25 * time.Hour)}, // 2 + {id: device4, lastSeen: now.Add(-2 * time.Hour)}, // 0 + } + expected := []protocol.ShortID{device4.Short(), device1.Short(), device3.Short(), device2.Short()} + + queue.Sort() + + if !reflect.DeepEqual(shortDevices(queue), expected) { + t.Error("expected different order") + } + }) + + t.Run("OldConnections", func(t *testing.T) { + t.Parallel() + + // Devices seen long ago should be randomized. + now := time.Now() + queue := dialQueue{ + {id: device1, lastSeen: now.Add(-5 * time.Hour)}, // 1 + {id: device2, lastSeen: now.Add(-50 * 24 * time.Hour)}, // 2, 3 + {id: device3, lastSeen: now.Add(-25 * 24 * time.Hour)}, // 2, 3 + {id: device4, lastSeen: now.Add(-2 * time.Hour)}, // 0 + } + + expected1 := []protocol.ShortID{device4.Short(), device1.Short(), device3.Short(), device2.Short()} + expected2 := []protocol.ShortID{device4.Short(), device1.Short(), device2.Short(), device3.Short()} + + var seen1, seen2 int + + for i := 0; i < 100; i++ { + queue.Sort() + res := shortDevices(queue) + if reflect.DeepEqual(res, expected1) { + seen1++ + continue + } + if reflect.DeepEqual(res, expected2) { + seen2++ + continue + } + t.Fatal("expected different order") + } + + if seen1 < 10 || seen2 < 10 { + t.Error("expected more even distribution", seen1, seen2) + } + }) + + t.Run("ShortLivedConnections", func(t *testing.T) { + t.Parallel() + + // Short lived connections should be sorted as if they were long ago + now := time.Now() + queue := dialQueue{ + {id: device1, lastSeen: now.Add(-5 * time.Hour)}, // 1 + {id: device2, lastSeen: now.Add(-3 * time.Hour)}, // 0 + {id: device3, lastSeen: now.Add(-25 * 24 * time.Hour)}, // 2, 3 + {id: device4, lastSeen: now.Add(-2 * time.Hour), shortLived: true}, // 2, 3 + } + + expected1 := []protocol.ShortID{device2.Short(), device1.Short(), device3.Short(), device4.Short()} + expected2 := []protocol.ShortID{device2.Short(), device1.Short(), device4.Short(), device3.Short()} + + var seen1, seen2 int + + for i := 0; i < 100; i++ { + queue.Sort() + res := shortDevices(queue) + if reflect.DeepEqual(res, expected1) { + seen1++ + continue + } + if reflect.DeepEqual(res, expected2) { + seen2++ + continue + } + t.Fatal("expected different order") + } + + if seen1 < 10 || seen2 < 10 { + t.Error("expected more even distribution", seen1, seen2) + } + }) +} + +func shortDevices(queue dialQueue) []protocol.ShortID { + res := make([]protocol.ShortID, len(queue)) + for i, qe := range queue { + res[i] = qe.id.Short() + } + return res +} diff --git a/lib/connections/service.go b/lib/connections/service.go index a1bec950b..78339ca6b 100644 --- a/lib/connections/service.go +++ b/lib/connections/service.go @@ -55,12 +55,14 @@ var ( ) const ( - perDeviceWarningIntv = 15 * time.Minute - tlsHandshakeTimeout = 10 * time.Second - minConnectionReplaceAge = 10 * time.Second - minConnectionLoopSleep = 5 * time.Second - stdConnectionLoopSleep = time.Minute - worstDialerPriority = math.MaxInt32 + perDeviceWarningIntv = 15 * time.Minute + tlsHandshakeTimeout = 10 * time.Second + minConnectionReplaceAge = 10 * time.Second + minConnectionLoopSleep = 5 * time.Second + stdConnectionLoopSleep = time.Minute + worstDialerPriority = math.MaxInt32 + recentlySeenCutoff = 7 * 24 * time.Hour + shortLivedConnectionThreshold = 5 * time.Second ) // From go/src/crypto/tls/cipher_suites.go @@ -415,6 +417,24 @@ func (s *service) bestDialerPriority(cfg config.Configuration) int { } func (s *service) dialDevices(ctx context.Context, now time.Time, cfg config.Configuration, bestDialerPriority int, nextDialAt map[string]time.Time, initial bool) { + // Figure out current connection limits up front to see if there's any + // point in resolving devices and such at all. + allowAdditional := 0 // no limit + connectionLimit := cfg.Options.LowestConnectionLimit() + if connectionLimit > 0 { + current := s.model.NumConnections() + allowAdditional = connectionLimit - current + if allowAdditional <= 0 { + l.Debugf("Skipping dial because we've reached the connection limit, current %d >= limit %d", current, connectionLimit) + return + } + } + + // Get device statistics for the last seen time of each device. This + // isn't critical, so ignore the potential error. + stats, _ := s.model.DeviceStatistics() + + queue := make(dialQueue, 0, len(cfg.Devices)) for _, deviceCfg := range cfg.Devices { // Don't attempt to connect to ourselves... if deviceCfg.DeviceID == s.myID { @@ -440,8 +460,34 @@ func (s *service) dialDevices(ctx context.Context, now time.Time, cfg config.Con } dialTargets := s.resolveDialTargets(ctx, now, cfg, deviceCfg, nextDialAt, initial, priorityCutoff) - if conn, ok := s.dialParallel(ctx, deviceCfg.DeviceID, dialTargets); ok { + if len(dialTargets) > 0 { + queue = append(queue, dialQueueEntry{ + id: deviceCfg.DeviceID, + lastSeen: stats[deviceCfg.DeviceID].LastSeen, + shortLived: stats[deviceCfg.DeviceID].LastConnectionDurationS < shortLivedConnectionThreshold.Seconds(), + targets: dialTargets, + }) + } + } + + // Sort the queue in an order we think will be useful (most recent + // first, deprioriting unstable devices, randomizing those we haven't + // seen in a long while). If we don't do connection limiting the sorting + // doesn't have much effect, but it may result in getting up and running + // quicker if only a subset of configured devices are actually reachable + // (by prioritizing those that were reachable recently). + dialQueue.Sort(queue) + + // Perform dials according to the queue, stopping when we've reached the + // allowed additional number of connections (if limited). + numConns := 0 + for _, entry := range queue { + if conn, ok := s.dialParallel(ctx, entry.id, entry.targets); ok { s.conns <- conn + numConns++ + if allowAdditional > 0 && numConns >= allowAdditional { + break + } } } } diff --git a/lib/connections/structs.go b/lib/connections/structs.go index 968d0b3fa..8a953b89e 100644 --- a/lib/connections/structs.go +++ b/lib/connections/structs.go @@ -18,6 +18,7 @@ import ( "github.com/syncthing/syncthing/lib/config" "github.com/syncthing/syncthing/lib/nat" "github.com/syncthing/syncthing/lib/protocol" + "github.com/syncthing/syncthing/lib/stats" "github.com/thejerf/suture/v4" ) @@ -193,9 +194,11 @@ type genericListener interface { type Model interface { protocol.Model AddConnection(conn protocol.Connection, hello protocol.Hello) + NumConnections() int Connection(remoteID protocol.DeviceID) (protocol.Connection, bool) OnHello(protocol.DeviceID, net.Addr, protocol.Hello) error GetHello(protocol.DeviceID) protocol.HelloIntf + DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) } type onAddressesChangedNotifier struct { diff --git a/lib/db/structs.pb.go b/lib/db/structs.pb.go index 7cd82c95d..907df92a5 100644 --- a/lib/db/structs.pb.go +++ b/lib/db/structs.pb.go @@ -8,10 +8,10 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/timestamp" github_com_syncthing_syncthing_lib_protocol "github.com/syncthing/syncthing/lib/protocol" protocol "github.com/syncthing/syncthing/lib/protocol" _ "github.com/syncthing/syncthing/proto/ext" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" diff --git a/lib/model/model.go b/lib/model/model.go index f0e98c1e3..ce1e88fac 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -101,7 +101,7 @@ type Model interface { Completion(device protocol.DeviceID, folder string) FolderCompletion ConnectionStats() map[string]interface{} - DeviceStatistics() (map[string]stats.DeviceStatistics, error) + DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) FolderStatistics() (map[string]stats.FolderStatistics, error) UsageReportingStats(report *contract.Report, version int, preview bool) @@ -193,6 +193,7 @@ var ( errEncryptionReceivedToken = errors.New("resetting connection to send info on new encrypted folder (new cluster config)") errMissingRemoteInClusterConfig = errors.New("remote device missing in cluster config") errMissingLocalInClusterConfig = errors.New("local device missing in cluster config") + errConnLimitReached = errors.New("connection limit reached") ) // NewModel creates and starts a new model. The model starts in read-only mode, @@ -727,6 +728,13 @@ func (info ConnectionInfo) MarshalJSON() ([]byte, error) { }) } +// NumConnections returns the current number of active connected devices. +func (m *model) NumConnections() int { + m.pmut.RLock() + defer m.pmut.RUnlock() + return len(m.conn) +} + // ConnectionStats returns a map with connection statistics for each device. func (m *model) ConnectionStats() map[string]interface{} { m.pmut.RLock() @@ -773,16 +781,16 @@ func (m *model) ConnectionStats() map[string]interface{} { } // DeviceStatistics returns statistics about each device -func (m *model) DeviceStatistics() (map[string]stats.DeviceStatistics, error) { +func (m *model) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) { m.fmut.RLock() defer m.fmut.RUnlock() - res := make(map[string]stats.DeviceStatistics, len(m.deviceStatRefs)) + res := make(map[protocol.DeviceID]stats.DeviceStatistics, len(m.deviceStatRefs)) for id, sr := range m.deviceStatRefs { stats, err := sr.GetStatistics() if err != nil { return nil, err } - res[id.String()] = stats + res[id] = stats } return res, nil } @@ -2049,10 +2057,14 @@ func (m *model) OnHello(remoteID protocol.DeviceID, addr net.Addr, hello protoco return errDevicePaused } - if len(cfg.AllowedNetworks) > 0 { - if !connections.IsAllowedNetwork(addr.String(), cfg.AllowedNetworks) { - return errNetworkNotAllowed - } + if len(cfg.AllowedNetworks) > 0 && !connections.IsAllowedNetwork(addr.String(), cfg.AllowedNetworks) { + // The connection is not from an allowed network. + return errNetworkNotAllowed + } + + if max := m.cfg.Options().ConnectionLimitMax; max > 0 && m.NumConnections() >= max { + // We're not allowed to accept any more connections. + return errConnLimitReached } return nil diff --git a/lib/model/model_test.go b/lib/model/model_test.go index 1c03ca816..cc9b9d029 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -3407,7 +3407,7 @@ func TestDeviceWasSeen(t *testing.T) { if err != nil { t.Error("Unexpected error:", err) } - entry := stats[device1.String()] + entry := stats[device1] if time.Since(entry.LastSeen) > time.Second { t.Error("device should have been seen now") } diff --git a/proto/lib/config/optionsconfiguration.proto b/proto/lib/config/optionsconfiguration.proto index 9ad017bff..5792be864 100644 --- a/proto/lib/config/optionsconfiguration.proto +++ b/proto/lib/config/optionsconfiguration.proto @@ -58,6 +58,14 @@ message OptionsConfiguration { bool send_full_index_on_upgrade = 49; repeated string feature_flags = 50; + // The number of connections at which we stop trying to connect to more + // devices, zero meaning no limit. Does not affect incoming connections. + int32 connection_limit_enough = 51; + + // The maximum number of connections which we will allow in total, zero + // meaning no limit. Affects incoming connections and prevents + // attempting outgoing connections. + int32 connection_limit_max = 52; // Legacy deprecated bool upnp_enabled = 9000 [deprecated = true, (ext.goname) = "DeprecatedUPnPEnabled"];