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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 9 additions and 55 deletions

View File

@ -23,7 +23,6 @@ import (
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"runtime/pprof"
"sort"
@ -60,9 +59,6 @@ import (
"github.com/syncthing/syncthing/lib/ur"
)
// matches a bcrypt hash and not too much else
var bcryptExpr = regexp.MustCompile(`^\$2[aby]\$\d+\$.{50,}`)
const (
DefaultEventMask = events.AllEvents &^ events.LocalChangeDetected &^ events.RemoteChangeDetected
DiskEventMask = events.LocalChangeDetected | events.RemoteChangeDetected

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
}
type quicDialerFactory struct {
cfg config.Wrapper
tlsCfg *tls.Config
}
type quicDialerFactory struct{}
func (quicDialerFactory) New(opts config.OptionsConfiguration, tlsCfg *tls.Config) genericDialer {
return &quicDialer{commonDialer{

View File

@ -15,7 +15,7 @@ import (
"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() {
if files != nil {

View File

@ -8,7 +8,6 @@ package db
import (
"bytes"
"errors"
"fmt"
"sort"
"strings"
@ -32,8 +31,6 @@ type migration struct {
migration func(prevSchema int) error
}
var errFolderMissing = errors.New("folder present in global list but missing in keyer index")
type databaseDowngradeError struct {
minSyncthingVersion string
}

View File

@ -396,25 +396,6 @@ func (vl *VersionList) findDevice(device []byte) (bool, int, int, bool) {
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) {
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:]...)
}
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 {
fv := FileVersion{
Version: version,

View File

@ -237,7 +237,6 @@ type logger struct {
events chan Event
funcs chan func(context.Context)
toUnsubscribe chan *subscription
stop chan struct{}
}
type Event struct {

View File

@ -7,10 +7,11 @@
package model
import (
"github.com/syncthing/syncthing/lib/protocol"
"reflect"
"sort"
"testing"
"github.com/syncthing/syncthing/lib/protocol"
)
var (
@ -46,9 +47,6 @@ func Test_chunk(t *testing.T) {
}
func Test_inOrderBlockPullReorderer_Reorder(t *testing.T) {
type args struct {
blocks []protocol.BlockInfo
}
tests := []struct {
name string
blocks []protocol.BlockInfo

View File

@ -25,7 +25,6 @@ type indexSender struct {
conn protocol.Connection
folder string
folderIsReceiveEncrypted bool
dev string
fset *db.FileSet
prevSequence int64
evLogger events.Logger

View File

@ -184,7 +184,6 @@ var (
errNetworkNotAllowed = errors.New("network not allowed")
errNoVersioner = errors.New("folder has no versioner")
// errors about why a connection is closed
errIgnoredFolderRemoved = errors.New("folder no longer ignored")
errReplacingConnection = errors.New("replacing connection")
errStopped = errors.New("Syncthing is being stopped")
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 {
addresses := []string{"dynamic"}
for _, addr := range device.Addresses {

View File

@ -426,6 +426,11 @@ func CpuBench(ctx context.Context, iterations int, duration time.Duration, useWe
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
return perf
}