Skip to content

Conversation

@calmh
Copy link
Member

@calmh calmh commented Jul 27, 2023

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:

  • In lib/protocol, func (Connection) ID() DeviceID is now called func (Connection) DeviceID() DeviceID() to disambiguate it from future other kind of IDs (the connection ID).
  • Also in 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.
  • Changes in model to the new signatures.
  • Changes in all the tests for the new signatures.
  • Minor tweaks to some tests while I was anywhere there... (parallelization, listening on 127.0.0.1 instead of 0.0.0.0 when possible.)
  • Harmonized log lines from showing full device ID to just short ID in places where I saw it and were anyway touching stuff...

@calmh calmh changed the title Refactor the protocol/model interface a bit Refactor the protocol/model interface a bit (ref #8981) Jul 27, 2023
@calmh calmh changed the title Refactor the protocol/model interface a bit (ref #8981) all: Refactor the protocol/model interface a bit (ref #8981) Jul 27, 2023
Copy link
Member

@imsodin imsodin left a 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.

calmh and others added 3 commits July 27, 2023 14:34
Copy link
Member

@imsodin imsodin left a 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.

@calmh
Copy link
Member Author

calmh commented Jul 29, 2023

Yeah it's super flaky, I have on my mental todo list to go through and unflake all the stuff that keeps randomly failing.

@calmh calmh merged commit 9d21b91 into syncthing:main Jul 29, 2023
@tomasz1986
Copy link
Member

The ref at #8981 seems like a typo.

@imsodin
Copy link
Member

imsodin commented Jul 29, 2023

Yep, should have been #8918 - I just assumed it was without checking. Bad reviewer, assuming is no good there :)

calmh added a commit to calmh/syncthing that referenced this pull request Jul 30, 2023
* 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)
@calmh calmh added this to the v1.23.7 milestone Jul 31, 2023
calmh added a commit to calmh/syncthing that referenced this pull request Aug 3, 2023
* 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)
@calmh calmh deleted the multiconrefactor branch September 6, 2023 11:08
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jul 28, 2024
@syncthing syncthing locked and limited conversation to collaborators Jul 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants