Skip to content

Conversation

@Minimaximize
Copy link

Ensure that calling close does not result in orphan tasks which will never be completed.

Previously each call of Close(details, reason) would result in the mCloseTask field in WampSessionClient being overwritten with a new task completion source, meaning previous calls to Close could no longer be completed as the session client no longer had access to the underlying TaskCompletionSource

Changes

  • Calling Close before the session client has initiated the wamp session (by sending a Hello to the server) throws a WampSessionNotEstablishedException
  • Calling Close before the SessionClient has connected (i.e. during a Challenge or before a Welcome message has been issued) will instead call Abort
  • Calling Close multiple times before the channel disconnects will return the same task

Liam James added 11 commits November 15, 2023 09:44
Prevent multiple calls of close from creating orphan TaskCompletionSources
This may indicate that the session has not yet authenticated or is still awaiting
a welcome message. In this case, Abort should be used to terminate the session
This previously would have resulted in close throwing a WampConnectionBroken exception
despite the fact that close was initated by the router
@Minimaximize Minimaximize marked this pull request as draft November 17, 2023 01:40
@Minimaximize
Copy link
Author

It occurred to me as I was making the pull request that I may have been aborting the connection to the server incorrectly (instead calling Abort as though the message had come from the server)

On that note, There is an issue where the WampSessionServer expects the Realm of a WampClientProxy to have already been set prior to Abort being called

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.

2 participants