mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 23:08:27 +00:00
lib/protocol: Clean up error values, unused flags
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3025
This commit is contained in:
parent
953482de53
commit
49387f9494
@ -200,7 +200,7 @@ next:
|
|||||||
ct, ok := s.connType[remoteID]
|
ct, ok := s.connType[remoteID]
|
||||||
if ok && !ct.IsDirect() && c.Type.IsDirect() {
|
if ok && !ct.IsDirect() && c.Type.IsDirect() {
|
||||||
l.Debugln("Switching connections", remoteID)
|
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) {
|
} else if s.model.ConnectedTo(remoteID) {
|
||||||
// We should not already be connected to the other party. TODO: This
|
// We should not already be connected to the other party. TODO: This
|
||||||
// could use some better handling. If the old connection is dead but
|
// 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 {
|
if conn := s.connectDirect(deviceID, addr); conn != nil {
|
||||||
l.Debugln("Connecting to", deviceID, "via", addr, "succeeded")
|
l.Debugln("Connecting to", deviceID, "via", addr, "succeeded")
|
||||||
if connected {
|
if connected {
|
||||||
s.model.Close(deviceID, fmt.Errorf("switching connections"))
|
s.model.Close(deviceID, protocol.ErrSwitchingConnections)
|
||||||
}
|
}
|
||||||
s.conns <- model.IntermediateConnection{
|
s.conns <- model.IntermediateConnection{
|
||||||
Conn: conn,
|
Conn: conn,
|
||||||
|
@ -64,11 +64,6 @@ const (
|
|||||||
UpdateTypeForget
|
UpdateTypeForget
|
||||||
)
|
)
|
||||||
|
|
||||||
// CLusterConfig flags
|
|
||||||
const (
|
|
||||||
FlagClusterConfigTemporaryIndexes uint32 = 1 << 0
|
|
||||||
)
|
|
||||||
|
|
||||||
// ClusterConfigMessage.Folders flags
|
// ClusterConfigMessage.Folders flags
|
||||||
const (
|
const (
|
||||||
FlagFolderReadOnly uint32 = 1 << 0
|
FlagFolderReadOnly uint32 = 1 << 0
|
||||||
@ -87,8 +82,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrClosed = errors.New("connection closed")
|
ErrClosed = errors.New("connection closed")
|
||||||
ErrTimeout = errors.New("read timeout")
|
ErrTimeout = errors.New("read timeout")
|
||||||
|
ErrSwitchingConnections = errors.New("switching connections")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Specific variants of empty messages...
|
// Specific variants of empty messages...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user