summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAudrius Butkevicius <audrius.butkevicius@gmail.com>2016-04-30 04:35:38 +0000
committerJakob Borg <jakob@nym.se>2016-04-30 04:35:38 +0000
commit49387f9494446c62baa39365772bfa7dcec581e0 (patch)
tree1220f02b98eba070e03371f9823b5757ee5cbb03
parent953482de530879b0f9bb9a68805b5e154cba892a (diff)
lib/protocol: Clean up error values, unused flags
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3025
-rw-r--r--lib/connections/connections.go4
-rw-r--r--lib/protocol/protocol.go10
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/connections/connections.go b/lib/connections/connections.go
index b20f60f97c..d0ff4e93ae 100644
--- a/lib/connections/connections.go
+++ b/lib/connections/connections.go
@@ -200,7 +200,7 @@ next:
ct, ok := s.connType[remoteID]
if ok && !ct.IsDirect() && c.Type.IsDirect() {
l.Debugln("Switching connections", remoteID)
- s.model.Close(remoteID, fmt.Errorf("switching connections"))
+ s.model.Close(remoteID, protocol.ErrSwitchingConnections)
} else if s.model.ConnectedTo(remoteID) {
// We should not already be connected to the other party. TODO: This
// could use some better handling. If the old connection is dead but
@@ -313,7 +313,7 @@ func (s *Service) connect() {
if conn := s.connectDirect(deviceID, addr); conn != nil {
l.Debugln("Connecting to", deviceID, "via", addr, "succeeded")
if connected {
- s.model.Close(deviceID, fmt.Errorf("switching connections"))
+ s.model.Close(deviceID, protocol.ErrSwitchingConnections)
}
s.conns <- model.IntermediateConnection{
Conn: conn,
diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go
index fffffec627..3de5d898e3 100644
--- a/lib/protocol/protocol.go
+++ b/lib/protocol/protocol.go
@@ -64,11 +64,6 @@ const (
UpdateTypeForget
)
-// CLusterConfig flags
-const (
- FlagClusterConfigTemporaryIndexes uint32 = 1 << 0
-)
-
// ClusterConfigMessage.Folders flags
const (
FlagFolderReadOnly uint32 = 1 << 0
@@ -87,8 +82,9 @@ const (
)
var (
- ErrClosed = errors.New("connection closed")
- ErrTimeout = errors.New("read timeout")
+ ErrClosed = errors.New("connection closed")
+ ErrTimeout = errors.New("read timeout")
+ ErrSwitchingConnections = errors.New("switching connections")
)
// Specific variants of empty messages...