all: Remove miscellaneous vestigial code (#7495)

This commit is contained in:
Jakob Borg
2021-03-17 22:23:12 +01:00
committed by GitHub
parent f4372710bf
commit 3ac858b150
10 changed files with 9 additions and 55 deletions
-4
View File
@@ -23,7 +23,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"regexp"
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
"sort" "sort"
@@ -60,9 +59,6 @@ import (
"github.com/syncthing/syncthing/lib/ur" "github.com/syncthing/syncthing/lib/ur"
) )
// matches a bcrypt hash and not too much else
var bcryptExpr = regexp.MustCompile(`^\$2[aby]\$\d+\$.{50,}`)
const ( const (
DefaultEventMask = events.AllEvents &^ events.LocalChangeDetected &^ events.RemoteChangeDetected DefaultEventMask = events.AllEvents &^ events.LocalChangeDetected &^ events.RemoteChangeDetected
DiskEventMask = events.LocalChangeDetected | events.RemoteChangeDetected DiskEventMask = events.LocalChangeDetected | events.RemoteChangeDetected
+1 -4
View File
@@ -90,10 +90,7 @@ func (d *quicDialer) Dial(ctx context.Context, _ protocol.DeviceID, uri *url.URL
return newInternalConn(&quicTlsConn{session, stream, createdConn}, connTypeQUICClient, quicPriority), nil return newInternalConn(&quicTlsConn{session, stream, createdConn}, connTypeQUICClient, quicPriority), nil
} }
type quicDialerFactory struct { type quicDialerFactory struct{}
cfg config.Wrapper
tlsCfg *tls.Config
}
func (quicDialerFactory) New(opts config.OptionsConfiguration, tlsCfg *tls.Config) genericDialer { func (quicDialerFactory) New(opts config.OptionsConfiguration, tlsCfg *tls.Config) genericDialer {
return &quicDialer{commonDialer{ return &quicDialer{commonDialer{
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/protocol"
) )
var files, filesUpdated, oneFile, firstHalf, secondHalf, changed100, unchanged100 []protocol.FileInfo var files, oneFile, firstHalf, secondHalf, changed100, unchanged100 []protocol.FileInfo
func lazyInitBenchFiles() { func lazyInitBenchFiles() {
if files != nil { if files != nil {
-3
View File
@@ -8,7 +8,6 @@ package db
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"sort" "sort"
"strings" "strings"
@@ -32,8 +31,6 @@ type migration struct {
migration func(prevSchema int) error migration func(prevSchema int) error
} }
var errFolderMissing = errors.New("folder present in global list but missing in keyer index")
type databaseDowngradeError struct { type databaseDowngradeError struct {
minSyncthingVersion string minSyncthingVersion string
} }
-27
View File
@@ -396,25 +396,6 @@ func (vl *VersionList) findDevice(device []byte) (bool, int, int, bool) {
return false, -1, -1, false return false, -1, -1, false
} }
func (vl *VersionList) popVersion(version protocol.Vector) (FileVersion, bool) {
i := vl.versionIndex(version)
if i == -1 {
return FileVersion{}, false
}
fv := vl.RawVersions[i]
vl.popVersionAt(i)
return fv, true
}
func (vl *VersionList) versionIndex(version protocol.Vector) int {
for i, v := range vl.RawVersions {
if version.Equal(v.Version) {
return i
}
}
return -1
}
func (vl *VersionList) popVersionAt(i int) { func (vl *VersionList) popVersionAt(i int) {
vl.RawVersions = append(vl.RawVersions[:i], vl.RawVersions[i+1:]...) vl.RawVersions = append(vl.RawVersions[:i], vl.RawVersions[i+1:]...)
} }
@@ -496,14 +477,6 @@ func popDeviceAt(devices [][]byte, i int) [][]byte {
return append(devices[:i], devices[i+1:]...) return append(devices[:i], devices[i+1:]...)
} }
func popDevice(devices [][]byte, device []byte) ([][]byte, bool) {
i := deviceIndex(devices, device)
if i == -1 {
return devices, false
}
return popDeviceAt(devices, i), true
}
func newFileVersion(device []byte, version protocol.Vector, invalid, deleted bool) FileVersion { func newFileVersion(device []byte, version protocol.Vector, invalid, deleted bool) FileVersion {
fv := FileVersion{ fv := FileVersion{
Version: version, Version: version,
-1
View File
@@ -237,7 +237,6 @@ type logger struct {
events chan Event events chan Event
funcs chan func(context.Context) funcs chan func(context.Context)
toUnsubscribe chan *subscription toUnsubscribe chan *subscription
stop chan struct{}
} }
type Event struct { type Event struct {
+2 -4
View File
@@ -7,10 +7,11 @@
package model package model
import ( import (
"github.com/syncthing/syncthing/lib/protocol"
"reflect" "reflect"
"sort" "sort"
"testing" "testing"
"github.com/syncthing/syncthing/lib/protocol"
) )
var ( var (
@@ -46,9 +47,6 @@ func Test_chunk(t *testing.T) {
} }
func Test_inOrderBlockPullReorderer_Reorder(t *testing.T) { func Test_inOrderBlockPullReorderer_Reorder(t *testing.T) {
type args struct {
blocks []protocol.BlockInfo
}
tests := []struct { tests := []struct {
name string name string
blocks []protocol.BlockInfo blocks []protocol.BlockInfo
-1
View File
@@ -25,7 +25,6 @@ type indexSender struct {
conn protocol.Connection conn protocol.Connection
folder string folder string
folderIsReceiveEncrypted bool folderIsReceiveEncrypted bool
dev string
fset *db.FileSet fset *db.FileSet
prevSequence int64 prevSequence int64
evLogger events.Logger evLogger events.Logger
-10
View File
@@ -184,7 +184,6 @@ var (
errNetworkNotAllowed = errors.New("network not allowed") errNetworkNotAllowed = errors.New("network not allowed")
errNoVersioner = errors.New("folder has no versioner") errNoVersioner = errors.New("folder has no versioner")
// errors about why a connection is closed // errors about why a connection is closed
errIgnoredFolderRemoved = errors.New("folder no longer ignored")
errReplacingConnection = errors.New("replacing connection") errReplacingConnection = errors.New("replacing connection")
errStopped = errors.New("Syncthing is being stopped") errStopped = errors.New("Syncthing is being stopped")
errEncryptionInvConfigLocal = errors.New("can't encrypt data for a device when the folder type is receiveEncrypted") errEncryptionInvConfigLocal = errors.New("can't encrypt data for a device when the folder type is receiveEncrypted")
@@ -1701,15 +1700,6 @@ func (m *model) handleAutoAccepts(deviceID protocol.DeviceID, folder protocol.Fo
} }
} }
func (m *model) newFolderConfiguration(id, label string, fsType fs.FilesystemType, path string) config.FolderConfiguration {
fcfg := m.cfg.DefaultFolder()
fcfg.ID = id
fcfg.Label = label
fcfg.FilesystemType = fsType
fcfg.Path = path
return fcfg
}
func (m *model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) config.DeviceConfiguration { func (m *model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) config.DeviceConfiguration {
addresses := []string{"dynamic"} addresses := []string{"dynamic"}
for _, addr := range device.Addresses { for _, addr := range device.Addresses {
+5
View File
@@ -426,6 +426,11 @@ func CpuBench(ctx context.Context, iterations int, duration time.Duration, useWe
perf = v perf = v
} }
} }
if blocksResult == nil {
// not looking at the blocksResult makes it unused from a static
// analysis / compiler standpoint...
panic("blocksResult should have been set by benchmark loop")
}
blocksResult = nil blocksResult = nil
return perf return perf
} }