-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement streamed session autoresets
Redesigns the way autoresets work a bunch. The server now sends a unique payload along with the autoreset request message. This is used by clients to recognize that the server supports this new style of autoreset and to correlate autoresets in the unlikely case of them overtaking each other. The autoreset now doesn't immediately start upon the first client responding. Instead, clients send along information about their operating system, recent latency measurements, reset capabilities (currently only the new "stream" capability) and if the user marked their network connection as "poor". The server collects these (under a time limit) and then determines the best client to perform the autoreset. At the time of writing, this goes in the order of: * Supporting streamed resets * Better operating systems (Android or the browser are worse) * Better network quality (according to client settings) * Lower average ping * Earlier autoreset response Whoever client gets the cut gets to perform the autoreset. If they don't support streamed autoresets, it proceeds as before. If they do support streamed autoresets, they are instructed to perform one of those. The client will send a stream-reset-start message, upon which the server will enqueue a soft reset and a start marker for the client, using the autoreset payload as the correlator. The client in turn uses this message with the matching correlator to send themselves an internal message through the paint engine that will give them a clean canvas state to build a reset image from. The reset image is packed into a new ResetStream meta message. This message contains gzip-compressed messages for the new reset image, which the server will decompress into a new, parallel image. Each of these message is acknowledged by the server before the client sends the next one, as to not their upstream entirely. Once the client is done sending their reset image, they tell the server that they're done and, as a sanity check, how many messages they expect to have been decompressed. The reset stream is then put into a pending state, to be resolved once all clients are caught up to the messages that have been added since after the reset stream was started (which, in most cases, will already be the case.) Once that occurs, the reset is resolved: all messages that have been added since the reset stream was started are packed on top of that new reset image and the session history is replaced with this new state. History positions of clients are shifted forward into the new area, block caches are shifted over to the new offsets etc. Server-side recordings (the ones done by the --record flag, not the .archived ones) are not touched, they will continue recording. The resulting state *should* be identical to what clients are already seeing, so they receive no indication that the session has been reset other than the session size in the corner shrinking to a smaller value. The client that does the streaming will get a message in the bottom-right corner telling them that they're compressing the session and uploading it, to give them an indication as to why Drawpile is using more resources or their network is more saturated. When an autoreset fails, the request state is reset and another round will be attempted after a delay. This also makes some ancillary changes along the way, like sending session size updates at a more reasonable time after a reset, replacing the int and uint for history positions and sizes with long long and size_t, as well as checking journal writes for failures. Setting the network quality to "poor" also no longer results in autoresets to be disabled entirely, instead they either transmit a bad network score under the new system or just delay the autoreset response by a bunch unter the old one. This relates to #1247.
- Loading branch information
1 parent
4b2f509
commit 0d7196f
Showing
65 changed files
with
3,742 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.