Xpra: Ticket #2351: dynamic client connection class

Taking #1838 one step further: when the client disables a feature completely (ie: clipboard) or when the client is not a UI client (ie: #2348) then we can generate a custom client class without those base classes.

get_client_connection_class needs to be made dynamic. We'll need a map from flags to mixins, ie:

 "clipboard" : ClipboardConnection,
 "webcam" : WebcamMixin,
etc..


Tue, 02 Jul 2019 19:09:46 GMT - Antoine Martin: status changed

Preparatory work in r23081.


Mon, 08 Jul 2019 16:19:37 GMT - Antoine Martin: milestone changed

This will be much easier to implement after dropping python2 support. (v4)


Fri, 03 Jan 2020 11:30:55 GMT - Antoine Martin: attachment set

implementation - causes server hangs on control-c


Sun, 05 Jan 2020 13:56:27 GMT - Antoine Martin:

No idea why, but re-doing the change step by step no longer crashes and so the code has been merged in r24907. The only mixin we currently skip is the mmap mixin.

Still TODO:


Sun, 05 Jan 2020 18:25:41 GMT - Antoine Martin:

Much improved in r24910, see commit message for details. With minor updates in r24911 + r24912 + r24913 + r24914. Minimal backport to help the server figure out what the client is capable of: r24915. With a regular client and xpra top connected:

$ xpra info | grep ".modules"
client.1.modules=('Client', 'ClientInfo', 'Clipboard', 'Audio', 'Webcam', 'FilePrint', 'MMAP', 'Input', 'DBUS', 'NetworkState', 'ClientDisplay', 'Windows', 'Encodings', 'AVSync', 'Idle')
client.modules=('Client', 'ClientInfo', 'Webcam', 'Input', 'DBUS', 'NetworkState', 'ClientDisplay', 'Idle')

Apart from the stated goals of not loading code we don't need (reducing attack surface, reducing memory usage, etc), there are additional benefits: we are forced to remove cross-mixin dependencies and this reduces contention on shared resources. ie: a client which has disabled the clipboard will make it easier for other users.

Some caveats.

Still TODO: test all possible combinations (one of the unit tests can do that - just disabled by default because it takes so long)


Thu, 06 Feb 2020 04:12:35 GMT - Antoine Martin: status changed; resolution set

Unless needed skip those mixins:

This allows the "top" client to load only the bare minimum:

client.modules=('Client', 'ClientInfo', 'ClientDisplay')

This will do for v4.


Sat, 23 Jan 2021 05:48:58 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2351