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:
parent
44d30c83bf
commit
e440d30028
|
@ -288,6 +288,10 @@ func (c *rawConnection) readerLoop() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := c.readMessage()
|
msg, err := c.readMessage()
|
||||||
|
if err == errUnknownMessage {
|
||||||
|
// Unknown message types are skipped, for future extensibility.
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue