diff --git a/xpra/client/mixins/mmap.py b/xpra/client/mixins/mmap.py index d7f7abd6a7..410e9413a0 100644 --- a/xpra/client/mixins/mmap.py +++ b/xpra/client/mixins/mmap.py @@ -4,6 +4,7 @@ # later version. See the file COPYING for details. import os +from random import randint from xpra.util import envbool, typedict from xpra.os_util import get_int_uuid @@ -132,7 +133,7 @@ def init_mmap(self, mmap_filename, mmap_group, socket_filename): if self.mmap_enabled: self.mmap_token = get_int_uuid() self.mmap_token_bytes = DEFAULT_TOKEN_BYTES - self.mmap_token_index = self.mmap_size - DEFAULT_TOKEN_BYTES + self.mmap_token_index = randint(0, self.mmap_size - DEFAULT_TOKEN_BYTES) write_mmap_token(self.mmap, self.mmap_token, self.mmap_token_index, self.mmap_token_bytes) def clean_mmap(self): diff --git a/xpra/server/source/mmap_connection.py b/xpra/server/source/mmap_connection.py index 2a5c4ce004..f61e3c9bbf 100644 --- a/xpra/server/source/mmap_connection.py +++ b/xpra/server/source/mmap_connection.py @@ -4,6 +4,8 @@ # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. +from random import randint + from xpra.util import typedict from xpra.server.source.stub_source_mixin import StubSourceMixin @@ -109,7 +111,7 @@ def mmapattr(k): from xpra.os_util import get_int_uuid self.mmap_client_token = get_int_uuid() self.mmap_client_token_bytes = DEFAULT_TOKEN_BYTES - self.mmap_client_token_index = self.mmap_size-self.mmap_client_token_bytes + self.mmap_client_token_index = randint(0, self.mmap_size-self.mmap_client_token_bytes) write_mmap_token(self.mmap, self.mmap_client_token, self.mmap_client_token_index,