-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
all: Refactor the protocol/model interface a bit (ref #8981) #9007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
imsodin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely very helpful to separate this large code churn from the large behaviour change - looks mostly good on a skim.
Co-authored-by: Simon Frei <freisim93@gmail.com>
imsodin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated: A filesystem watcher test times out on macos - maybe truly a (flaky) hangup or possibly just need to extend the timeout as GHA macos FS might just be super slow.
|
Yeah it's super flaky, I have on my mental todo list to go through and unflake all the stuff that keeps randomly failing. |
|
The ref at #8981 seems like a typo. |
|
Yep, should have been #8918 - I just assumed it was without checking. Bad reviewer, assuming is no good there :) |
* main: all: Refactor the protocol/model interface a bit (ref syncthing#8981) (syncthing#9007) lib/connections: Fix building with `-tags noquic` (syncthing#9009) gui: Fix tooltips on buttons inside button groups (ref syncthing#7984) (syncthing#9008)
* main: build: Increase Go version to 1.20.7 lib/config: Allow sharing already encrypted folder with untrusted devices (fixes syncthing#8965) (syncthing#9012) gui: Use case-insensive and backslash-agnostic versions filter (fixes syncthing#7973) (syncthing#8995) gui, man, authors: Update docs, translations, and contributors build: Run govulncheck (fixes syncthing#8983) build: Run build & tests on main branch nightly build: Send test logs to Grafana Loki for statistics all: Refactor the protocol/model interface a bit (ref syncthing#8981) (syncthing#9007) lib/connections: Fix building with `-tags noquic` (syncthing#9009) gui: Fix tooltips on buttons inside button groups (ref syncthing#7984) (syncthing#9008) cmd/strelaysrv: Handle accept error with debug set (fixes syncthing#9001) (syncthing#9004) lib/api: Fix data race in TestCSRFRequired (syncthing#9006) gui: Show full error for failed items (syncthing#9005) lib/api: Allow `Bearer` authentication style with API key (syncthing#9002)
These are refactoring changes made in the multiple-connection PR (#8918), broken out to reduce the noise there. Hence reviewing it requires some suspension of disbelief in terms of whether these changes are necessary -- they are, over there, but not necessarily by themselves over here... :) The changes are:
lib/protocol,func (Connection) ID() DeviceIDis now calledfunc (Connection) DeviceID() DeviceID()to disambiguate it from future other kind of IDs (the connection ID).lib/protocol, all the callbacks used to take the device ID as the first parameter to explain where they came from. These now get the actual Connection instead, which is more specific and enables things like replying on the same connection. There's some juggling to accomplish this, because the actual protocol code that does the callbacks (rawConnection) doesn't have a clue about a "connection", it just has a reader and a writer for the bytes. Thus the callback interface is split up -- inside the protocol, it doesn't take a connection or device ID as parameter (contextLessModel), it is assumed that whoever created the connection knows what the callbacks refer to. Then there is a small wrapper (connectionWrappingModel) struct that does precisely this: intercepts the callbacks, adds the connection info, and then calls them again upwards.