Skip to content
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

lib/connections: Fix connection switching #3480

Closed

Conversation

AudriusButkevicius
Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Aug 5, 2016

Purpose

It seems that it would be impossible to drop down to relay after establishing a direct connection
Also, we should not drop the existing connection until after we've passed the validation steps,
and it seems it's being dropped in two places unnecesserily at the moment.

Testing

None what so ever.

It seems that it would be impossible to drop down to relay after establishing a direct connection
Also, we should not drop the existing connection until after we've passed the validation steps,
and it seems it's being dropped in two places unnecesserily at the moment.
@calmh
Copy link
Member

calmh commented Aug 5, 2016

Lgtm but let me do some actual testing since I anyway intended to do that

@calmh
Copy link
Member

calmh commented Aug 5, 2016

I have a vague suspicion that something like the following can happen, but it's not confirmed at all:

  • relay connection exists
  • direct connection comes in
  • we drop relay connection
  • we add direct connection
  • other side drops relay connection, we get some error, call close
  • close is based on device id, we remove the direct connection for that device id that we added milliseconds ago
  • index sending starts for the direct connection that we just added and closed
  • panic

But needs investigation...

@AudriusButkevicius
Copy link
Member Author

AudriusButkevicius commented Aug 5, 2016

As we ourselves close, we need to make sure it never calls into the model again.

@calmh
Copy link
Member

calmh commented Aug 7, 2016

@st-review merge it

@st-review
Copy link

👌 Merged as a4f052a. Thanks, @AudriusButkevicius!

@st-review st-review closed this Aug 7, 2016
st-review pushed a commit that referenced this pull request Aug 7, 2016
It seems that it would be impossible to drop down to relay after establishing a direct connection
Also, we should not drop the existing connection until after we've passed the validation steps,
and it seems it's being dropped in two places unnecesserily at the moment.

GitHub-Pull-Request: #3480
@calmh
Copy link
Member

calmh commented Aug 7, 2016

No testing yet but it looks safe. We should look again into the possible race condition described above or something similar.

@AudriusButkevicius AudriusButkevicius deleted the switchc branch August 7, 2016 16:03
@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 Aug 7, 2017
@syncthing syncthing locked and limited conversation to collaborators Aug 7, 2017
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.

None yet

3 participants