1
0
Эх сурвалжийг харах

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
Jakob Borg 9 жил өмнө
parent
commit
e440d30028

+ 4 - 0
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
 		}