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
This commit is contained in:
Jakob Borg 2016-07-05 09:29:28 +00:00 committed by Audrius Butkevicius
parent 44d30c83bf
commit e440d30028
1 changed files with 4 additions and 0 deletions

View File

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