From 2eb8a9ef5676f745fbac9dca45ee86f7b389e37f Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sat, 9 Apr 2016 01:10:31 +0000 Subject: [PATCH] all: Dead code cleanup --- cmd/syncthing/main.go | 1 - lib/model/model.go | 4 ---- lib/protocol/common_test.go | 26 +------------------------- lib/protocol/protocol.go | 10 ---------- lib/scanner/walk_test.go | 4 ---- 5 files changed, 1 insertion(+), 44 deletions(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 2e6e9b1d..f4b3b56c 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -117,7 +117,6 @@ func init() { var ( myID protocol.DeviceID stop = make(chan int) - cert tls.Certificate lans []*net.IPNet ) diff --git a/lib/model/model.go b/lib/model/model.go index 28266fac..21f1503a 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -304,10 +304,6 @@ func (info ConnectionInfo) MarshalJSON() ([]byte, error) { // ConnectionStats returns a map with connection statistics for each device. func (m *Model) ConnectionStats() map[string]interface{} { - type remoteAddrer interface { - RemoteAddr() net.Addr - } - m.pmut.RLock() m.fmut.RLock() diff --git a/lib/protocol/common_test.go b/lib/protocol/common_test.go index 6db987d9..c3b8cce5 100644 --- a/lib/protocol/common_test.go +++ b/lib/protocol/common_test.go @@ -2,10 +2,7 @@ package protocol -import ( - "io" - "time" -) +import "time" type TestModel struct { data []byte @@ -60,24 +57,3 @@ func (t *TestModel) closedError() error { return nil // Timeout } } - -type ErrPipe struct { - io.PipeWriter - written int - max int - err error - closed bool -} - -func (e *ErrPipe) Write(data []byte) (int, error) { - if e.closed { - return 0, e.err - } - if e.written+len(data) > e.max { - n, _ := e.PipeWriter.Write(data[:e.max-e.written]) - e.PipeWriter.CloseWithError(e.err) - e.closed = true - return n, e.err - } - return e.PipeWriter.Write(data) -} diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index 37fe9570..cceae995 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -566,16 +566,6 @@ func (c *rawConnection) handleResponse(msgID int, resp ResponseMessage) { c.awaitingMut.Unlock() } -func (c *rawConnection) handlePong(msgID int) { - c.awaitingMut.Lock() - if rc := c.awaiting[msgID]; rc != nil { - c.awaiting[msgID] = nil - rc <- asyncResult{} - close(rc) - } - c.awaitingMut.Unlock() -} - func (c *rawConnection) send(msgID int, msgType int, msg encodable, done chan struct{}) bool { if msgID < 0 { select { diff --git a/lib/scanner/walk_test.go b/lib/scanner/walk_test.go index 5b36e072..47535ad4 100644 --- a/lib/scanner/walk_test.go +++ b/lib/scanner/walk_test.go @@ -45,10 +45,6 @@ var testdata = testfileList{ {"further-excludes", 5, "7eb0a548094fa6295f7fd9200d69973e5f5ec5c04f2a86d998080ac43ecf89f1"}, } -var correctIgnores = map[string][]string{ - ".": {".*", "quux"}, -} - func init() { // This test runs the risk of entering infinite recursion if it fails. // Limit the stack size to 10 megs to crash early in that case instead of