Ver Fonte

Remove dead code

Audrius Butkevicius há 10 anos atrás
pai
commit
5b03c2d949

+ 0 - 8
cmd/syncthing/debug.go

@@ -22,11 +22,3 @@ func init() {
 	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")
 }
-
-func shouldDebugMain() bool {
-	return l.ShouldDebug("main")
-}
-
-func shouldDebugHTTP() bool {
-	return l.ShouldDebug("http")
-}

+ 0 - 4
lib/beacon/beacon.go

@@ -25,10 +25,6 @@ type Interface interface {
 	Error() error
 }
 
-type readerFrom interface {
-	ReadFrom([]byte) (int, net.Addr, error)
-}
-
 type errorHolder struct {
 	err error
 	mut stdsync.Mutex // uses stdlib sync as I want this to be trivially embeddable, and there is no risk of blocking

+ 0 - 32
lib/discover/local.go

@@ -10,7 +10,6 @@ import (
 	"bytes"
 	"encoding/hex"
 	"errors"
-	"fmt"
 	"io"
 	"net"
 	"net/url"
@@ -238,34 +237,3 @@ func (c *localClient) registerDevice(src net.Addr, device Device) bool {
 
 	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
-}

+ 0 - 10
lib/model/model.go

@@ -354,16 +354,6 @@ func (m *Model) Completion(device protocol.DeviceID, folder string) float64 {
 	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) {
 	if !f.IsDeleted() {
 		files++

+ 1 - 11
lib/model/rwfolder.go

@@ -49,7 +49,7 @@ const retainBits = os.ModeSetgid | os.ModeSetuid | os.ModeSticky
 
 var (
 	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 (
@@ -1429,16 +1429,6 @@ func (p *rwFolder) inConflict(current, replacement protocol.Vector) bool {
 	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 {
 	for i := range devices {
 		if devices[i] == device {

+ 0 - 4
lib/sync/debug.go

@@ -33,7 +33,3 @@ func init() {
 	}
 	l.Debugf("Enabling lock logging at %v threshold", threshold)
 }
-
-func shouldDebug() bool {
-	return l.ShouldDebug("sync")
-}

+ 1 - 1
test/scan_test.go

@@ -29,7 +29,7 @@ func TestSubScan(t *testing.T) {
 		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"
 	// 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"