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

v4.0 QLocalSocket implementation #192

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

v4.0 QLocalSocket implementation #192

wants to merge 4 commits into from

Conversation

itay-grudev
Copy link
Owner

@itay-grudev itay-grudev commented May 20, 2024

In v4.0 the objective is to use QLocalSocket for not only for inter-instance communication, but for proof of being the primary instance. Only one instance at a time can be the QLocalServer which is what I am using as the proof of primary instead of QSharedMemory.

We also make Qt6 the default.

There are several important considerations. As we will now rely on prompt responses from theQLocalServer it 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 MessageCoder class which uses QDataStream and 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 SingleApplicationMessage class, 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

@itay-grudev itay-grudev changed the title SingleApplicationMessage the core of the v4.0 communication v4.0 QLocalSocket implementation May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant