Request view to the server on layer/decoration send_message method #389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This address a small bug where the send_message method could de-sync the server state, leading to events being sent for a stale view.
#379 addressed the issue where multiple events were sent by the server by pooling & buffering them. However, since
send_messagesends a new view after updating the state, it was possible to have views in-flight without the server knowledge, leading to events arriving with stale widget ids if the server sent event in the meantime.This PR address this de-sync by having the client ask the server to request a new view instead of sending it right after updating its state.
On server side, the surface is marked with a flag forcing it to send an event, even if there are no message (if there are, no additional event is sent). This forces the server to buffer further events until a new view is received.
On client side, the program state is updated, then the request is sent. If there were no pending event, the client will receive an empty event array, and will not update a second time. If there were pending event, they will be handled normally once the previous view is applied. In that case, the client will receive the messages linked to the server-side event and update normally.
Fixes #388