Skip to content

Commit

Permalink
#4491 default to mmap read only for clients
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 6, 2025
1 parent 0365fe3 commit 5730fd0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ def pretty_cmd(cmd: Sequence[str]) -> str:
'mousewheel' : "on",
'printing' : bstr(printing_ENABLED),
'dbus_control' : bstr(dbus_ENABLED),
'mmap' : bstr(True),
'mmap' : "auto",
'opengl' : "no" if OSX else "probe",
'headerbar' : ["auto", "no"][OSX or WIN32],
}
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/unit/client/mixins/mmap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def close(self):
for mmap_option, ctx in {
"off": nullcontext(),
"on": silence_info(mmap),
"auto": silence_info(mmap),
tmp_dir+"/xpra-mmap-test-file-%i" % os.getpid(): silence_info(mmap),
tmp_dir+"/xpra-fail-mmap-test-file-%i" % os.getpid(): silence_error(mmap),
}.items():
Expand Down
10 changes: 7 additions & 3 deletions xpra/client/mixins/mmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ def init(self, opts) -> None:
self.mmap_supported = False
return
self.mmap_supported = True
if opts.mmap.lower() not in TRUE_OPTIONS:
filenames = opts.mmap.split(os.path.pathsep)
else:
if opts.mmap.lower() == "auto":
# by default, only enable mmap reads, not writes:
filenames = ("", )
elif opts.mmap.lower() in TRUE_OPTIONS:
filenames = ("", "")
else:
# assume file path(s) have been specified:
filenames = opts.mmap.split(os.path.pathsep)
group = opts.mmap_group
root_w, root_h = self.get_root_size()
# at least 256MB, or 8 fullscreen RGBX frames:
Expand Down
2 changes: 1 addition & 1 deletion xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def get_defaults() -> dict[str, Any]:
"reconnect" : True,
"tray" : True,
"pulseaudio" : DEFAULT_PULSEAUDIO,
"mmap" : "yes",
"mmap" : "auto",
"mmap-group" : "auto",
"video" : True,
"audio" : True,
Expand Down

0 comments on commit 5730fd0

Please sign in to comment.