Remove dead code

This commit is contained in:
Audrius Butkevicius 2015-10-25 20:46:09 +00:00
parent f629a998a0
commit 5b03c2d949
7 changed files with 2 additions and 70 deletions

View File

@ -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")
}

View File

@ -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

View File

@ -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
}

View File

@ -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++

View File

@ -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 {

View File

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

View File

@ -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"