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

send_message on wamp_session::process_goodbye throws always #224

Open
pratman opened this issue Jan 29, 2021 · 5 comments
Open

send_message on wamp_session::process_goodbye throws always #224

pratman opened this issue Jan 29, 2021 · 5 comments

Comments

@pratman
Copy link

pratman commented Jan 29, 2021

with:

  1. process_goodybe setting m_session_id = 0;
  2. calling send_message with parameter session_established defaulted to true
  3. condition if (session_established && !m_session_id) will always be true

this results into throwing no_session_error() that will be uncaught and crash the application

@pratman pratman changed the title send message on wamp_session::process_goodbye throws always send_message on wamp_session::process_goodbye throws always Jan 29, 2021
@KnoerleMan
Copy link

Does setting the session id to zero has to be done in process_goodbye (line 834) ?
This is done when leaving the session inside the dispatched handler (line 225).

For me it looks like setting the id to zero at that point should not be done, since we only want to reply to a goodbye message from the peer, or do nothing in case we called leave.

@pratman
Copy link
Author

pratman commented Mar 5, 2021

I think at least is clear that it should not be set to 0 before send_message as it will just always throw.

@oberstet
Copy link
Contributor

oberstet commented Mar 5, 2021

that sounds like a bug: obviously, to send a goodbye or reply to one, the session ID is still needed. it should be zero'ed only after that. it should be zero'ed, since that signals "no session currently attached". after replying to a goodbye with a goodbye, no further message must be sent. when sending a goodbye in the first place (active leave), a response is expected but no additional message must be sent. IOW: goodbye is always the last message sent on a session.

@pratman
Copy link
Author

pratman commented Mar 9, 2021

Additionally, all other send_message calls are wrapped on try-catch, but the ones in process_goodbye and process_invocation.

Also setting session id to 0, signals "internally" that no more messages should be sent. But for the user of the session, there is no inmediate notification about it. Caller of session would also need to get such information ASAP.

@oberstet
Copy link
Contributor

oberstet commented Mar 9, 2021

Also setting session id to 0, signals "internally" that no more messages should be sent. But for the user of the session, there is no inmediate notification about it. Caller of session would also need to get such information ASAP.

yes, absolutely: the "on-leave" should fire, and allow user code to react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants