mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-14 01:04:14 +00:00
Remove dead code
This commit is contained in:
parent
f629a998a0
commit
5b03c2d949
@ -22,11 +22,3 @@ func init() {
|
|||||||
l.SetDebug("main", strings.Contains(os.Getenv("STTRACE"), "main") || os.Getenv("STTRACE") == "all")
|
l.SetDebug("main", strings.Contains(os.Getenv("STTRACE"), "main") || os.Getenv("STTRACE") == "all")
|
||||||
l.SetDebug("http", strings.Contains(os.Getenv("STTRACE"), "http") || os.Getenv("STTRACE") == "all")
|
l.SetDebug("http", strings.Contains(os.Getenv("STTRACE"), "http") || os.Getenv("STTRACE") == "all")
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldDebugMain() bool {
|
|
||||||
return l.ShouldDebug("main")
|
|
||||||
}
|
|
||||||
|
|
||||||
func shouldDebugHTTP() bool {
|
|
||||||
return l.ShouldDebug("http")
|
|
||||||
}
|
|
||||||
|
@ -25,10 +25,6 @@ type Interface interface {
|
|||||||
Error() error
|
Error() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type readerFrom interface {
|
|
||||||
ReadFrom([]byte) (int, net.Addr, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type errorHolder struct {
|
type errorHolder struct {
|
||||||
err error
|
err error
|
||||||
mut stdsync.Mutex // uses stdlib sync as I want this to be trivially embeddable, and there is no risk of blocking
|
mut stdsync.Mutex // uses stdlib sync as I want this to be trivially embeddable, and there is no risk of blocking
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -238,34 +237,3 @@ func (c *localClient) registerDevice(src net.Addr, device Device) bool {
|
|||||||
|
|
||||||
return isNewDevice
|
return isNewDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
func addrToAddr(addr *net.TCPAddr) string {
|
|
||||||
if len(addr.IP) == 0 || addr.IP.IsUnspecified() {
|
|
||||||
return fmt.Sprintf(":%c", addr.Port)
|
|
||||||
} else if bs := addr.IP.To4(); bs != nil {
|
|
||||||
return net.JoinHostPort(bs.String(), strconv.Itoa(addr.Port))
|
|
||||||
} else if bs := addr.IP.To16(); bs != nil {
|
|
||||||
return net.JoinHostPort(bs.String(), strconv.Itoa(addr.Port))
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func resolveAddrs(addrs []string) []string {
|
|
||||||
var raddrs []string
|
|
||||||
for _, addrStr := range addrs {
|
|
||||||
uri, err := url.Parse(addrStr)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
addrRes, err := net.ResolveTCPAddr("tcp", uri.Host)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
addr := addrToAddr(addrRes)
|
|
||||||
if len(addr) > 0 {
|
|
||||||
uri.Host = addr
|
|
||||||
raddrs = append(raddrs, uri.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return raddrs
|
|
||||||
}
|
|
||||||
|
@ -354,16 +354,6 @@ func (m *Model) Completion(device protocol.DeviceID, folder string) float64 {
|
|||||||
return completionPct
|
return completionPct
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeOf(fs []protocol.FileInfo) (files, deleted int, bytes int64) {
|
|
||||||
for _, f := range fs {
|
|
||||||
fs, de, by := sizeOfFile(f)
|
|
||||||
files += fs
|
|
||||||
deleted += de
|
|
||||||
bytes += by
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func sizeOfFile(f db.FileIntf) (files, deleted int, bytes int64) {
|
func sizeOfFile(f db.FileIntf) (files, deleted int, bytes int64) {
|
||||||
if !f.IsDeleted() {
|
if !f.IsDeleted() {
|
||||||
files++
|
files++
|
||||||
|
@ -49,7 +49,7 @@ const retainBits = os.ModeSetgid | os.ModeSetuid | os.ModeSticky
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
activity = newDeviceActivity()
|
activity = newDeviceActivity()
|
||||||
errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later.")
|
errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -1429,16 +1429,6 @@ func (p *rwFolder) inConflict(current, replacement protocol.Vector) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func invalidateFolder(cfg *config.Configuration, folderID string, err error) {
|
|
||||||
for i := range cfg.Folders {
|
|
||||||
folder := &cfg.Folders[i]
|
|
||||||
if folder.ID == folderID {
|
|
||||||
folder.Invalid = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func removeDevice(devices []protocol.DeviceID, device protocol.DeviceID) []protocol.DeviceID {
|
func removeDevice(devices []protocol.DeviceID, device protocol.DeviceID) []protocol.DeviceID {
|
||||||
for i := range devices {
|
for i := range devices {
|
||||||
if devices[i] == device {
|
if devices[i] == device {
|
||||||
|
@ -33,7 +33,3 @@ func init() {
|
|||||||
}
|
}
|
||||||
l.Debugf("Enabling lock logging at %v threshold", threshold)
|
l.Debugf("Enabling lock logging at %v threshold", threshold)
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldDebug() bool {
|
|
||||||
return l.ShouldDebug("sync")
|
|
||||||
}
|
|
||||||
|
@ -29,7 +29,7 @@ func TestSubScan(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Scan a single file in a known directory "file1.txt"
|
// 1. Scan a single file it a known directory "file1.txt"
|
||||||
// 2. Scan a single file in an unknown directory "filetest/file1.txt"
|
// 2. Scan a single file in an unknown directory "filetest/file1.txt"
|
||||||
// 3. Scan a single file in a deep unknown directory "filetest/1/2/3/4/5/6/7/file1.txt"
|
// 3. Scan a single file in a deep unknown directory "filetest/1/2/3/4/5/6/7/file1.txt"
|
||||||
// 4. Scan a directory in a deep unknown directory "dirtest/1/2/3/4/5/6/7"
|
// 4. Scan a directory in a deep unknown directory "dirtest/1/2/3/4/5/6/7"
|
||||||
|
Loading…
Reference in New Issue
Block a user