From e440d3002877a5fb7ae0ada5b5843b011b00c9bd Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 5 Jul 2016 09:29:28 +0000 Subject: [PATCH] lib/protocol: Allow unknown message types This lets us add message types in the future, for authentication or other purposes, without completely breaking old clients. I see this as similar behavior to adding fields to messages - newer clients must simple be aware that older ones may ignore the message and act accordingly. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3390 --- lib/protocol/protocol.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index cfe6ea70..cfbe0627 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -288,6 +288,10 @@ func (c *rawConnection) readerLoop() (err error) { } msg, err := c.readMessage() + if err == errUnknownMessage { + // Unknown message types are skipped, for future extensibility. + continue + } if err != nil { return err }