Description
Significant progress on this has already been made, but I figured it would be good to have some kind of tracking issue since it's a big change.
The connmgr component uses async tasks, driven by the Executor
and Reactor
Rust types, whereas the proxy and handler components use callbacks driven by the Qt event loop (QEventLoop
/ QCoreApplication
). Ideally, we could consolidate on the same Rust-based evented subsystem for all three components. In other words, the proxy and handler ought to be able to use Reactor
(and perhaps more) in place of the Qt event loop.
Benefits of this change:
- The proxy and handler get a more performant evented subsystem.
- Consistent behavior across all components. Don't have two subsystems to debug.
- Opens the door to potentially being able to run evented Rust code and evented C++ code in the same thread.
In order to move off of the Qt event loop to something else, we need substitutes for all things we are using that depend on it. These are:
QTimer
QSocketNotifier
QTcpSocket
&QTcpServer
QLocalSocket
&QLocalServer
QMetaObject::invokeMethod
withQt::QueuedConnection
QObject::deleteLater
We also need some kind of event loop substitute that allows registering callbacks for socket/timer activity, similar to QAbstractEventDispatcher
but built on top of Reactor
.
Tasks:
- - Make a substitute event loop class on top of
Reactor
, allowing callback registrations for file descriptors and timers. - - Make a socket notifier class that works with the new event loop.
- - Make a timer class that works with the new event loop.
- - Make a mechanism for deferred calls (including deferred deletes), based on our timers.
- - Make it possible to queue calls across threads.
- - Make TCP socket/listener classes, based on our socket notifiers.
- - Make Unix socket/listener classes, based on our socket notifiers.
- - Use our alternatives everywhere in the handler. Listing this component first since it's single threaded and therefore a little easier.
- - Use our alternatives everywhere in the proxy.
Activity