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

fix: disconnect called before connection has completed #107 #150

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

Julusian
Copy link
Member

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

bug fix

  • What is the current behavior? (You can also link to an open issue here)

fixes #107

The cause was the assignment of _socketProcess happening async, meaning that if disconnect or destroy was called before that promise had resolved, then it would look like connect had never been called, and the cleanup would be skipped

  • What is the new behavior (if this is a feature change)?

There are two parts here.

  1. _isDisconnecting is used by disconnect to skip the call to the threads connect method if disconnect is called while the thread is being created. Once the thread is created, disconnect previously operated as expected
  2. _creatingSocket is used by destroy, so that it can wait for the thread creation to complete before attempting to destroy the thread. in the future, maybe this creation can be abortable, but that will require changes in threadedclass
  • Other information:

Only given a very light synthetic test so far.

@Julusian Julusian requested a review from a team July 31, 2023 12:53
@Julusian Julusian merged commit 005f0d5 into master Aug 2, 2023
14 checks passed
@Julusian Julusian deleted the fix/immediate-disconnect-call branch August 2, 2023 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Atem still connects when disconnect called immediately after connect called
2 participants