v4.0 QLocalSocket implementation #192
Draft
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.
In
v4.0the objective is to useQLocalSocketfor not only for inter-instance communication, but for proof of being the primary instance. Only one instance at a time can be theQLocalServerwhich is what I am using as the proof of primary instead ofQSharedMemory.We also make
Qt6the default.There are several important considerations. As we will now rely on prompt responses from the
QLocalServerit needs to run in a separate thread, to ensure the application doesn't block it from responding to messages.I also want to remove the stateful messages, which were added as a fix in
3.0.Instead all messages are encoded/decoded through the
MessageCoderclass which usesQDataStreamand directly attaches to the socket data stream. When we parse the message from the socket, if the parse fails, we skip over one byte and try again until we succeed. This ensures even if the data is garbled we will eventually parse the next message.I kind of wanted a more self-contained message interface hence the
SingleApplicationMessageclass, but I couldn't figure out how to fit it in.There are a lot of
TODOs with code that needs to be implemented and stubbed functions.I also want to add an instance counter based on the connection map pings all the sockets to count running secondary instances, etc. See #89