Connection-scoped state (static channels, DVC/USB routing, echo/autodetect bookkeeping, etc.) currently lives on RdpServer and is reset by hand between connections. That makes the state lifetime implicit. It is easy for state from a previous connection to leak into the next one, and it forces client_loop to share &mut RdpServer across select! branches.
On the RdpClient, ironrdp-session::ActiveStage already follows a cleaner model. I'd like to refactor ironrdp-server in the same direction:
- move connection-scoped fields out of RdpServer into a struct created after acceptance and dropped at the end of the connection;
- keep server-scoped state (config, handlers, factories) on RdpServer;
- separate activation-scoped state so that deactivation/reactivation doesn't need to move the static channels through the acceptor.
This would also make #1512 easier to address later. And some other lifecycle mismatch problems can be fixed.
Connection-scoped state (static channels, DVC/USB routing, echo/autodetect bookkeeping, etc.) currently lives on
RdpServerand is reset by hand between connections. That makes the state lifetime implicit. It is easy for state from a previous connection to leak into the next one, and it forces client_loop to share &mut RdpServer across select! branches.On the
RdpClient, ironrdp-session::ActiveStage already follows a cleaner model. I'd like to refactor ironrdp-server in the same direction:This would also make #1512 easier to address later. And some other lifecycle mismatch problems can be fixed.