Open pratman opened 3 years ago
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.
I think at least is clear that it should not be set to 0 before send_message as it will just always throw.
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.
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.
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
with:
this results into throwing no_session_error() that will be uncaught and crash the application