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

adding more tracing detail on failure condition #75

Merged
merged 2 commits into from
May 6, 2024
Merged

Conversation

heckj
Copy link
Collaborator

@heckj heckj commented May 6, 2024

Adding more tracing in WebSocket, and fixing a logic flaw (event flow issue) where relevant mutable state was known but not correctly set in place when external events could be triggered - specifically, inital sync on connecting to a peer can trigger concurrently with finishing setup such that the send() can't operate since the connection state isn't finished setting up. Re-ordered that flow so that state is set up completely before that signal is sent.

That signal could be sent outside of the attemptConnect() flow, but two places can potentially call this logic flow, so keeping it together and (unfortunately - as a side effect) seemed like a better way to collapse the detail to be able to reason about it. I changed up the return value from attemptConnect() so that it's a bit "less" of a pure function, but it's (more) obvious that it operates on context/state and updates it (a mutable function)

@heckj heckj self-assigned this May 6, 2024
and didn't have everything that was expected in place, although we knew
it all.

attemptConnect() now sets what it needs as a side effect and only
returns a Boolean (success/fail) indicator - it may not even need to do
that.
@heckj heckj merged commit f23c184 into main May 6, 2024
1 check passed
@heckj heckj deleted the websocket-tracing branch May 6, 2024 19:40
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.

None yet

1 participant