summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-27 08:32:12 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-27 08:39:28 (GMT)
commit89b8712761b04576c642ef8e474878061653fdb3 (patch)
tree45ccd9a98041f7b57fdfc1ed8c0f8653d4fed703
parentb2865f1195f92ba0b39964edf1981a508b70e7a9 (diff)
kajonggtest: simplify socketname
-rwxr-xr-xsrc/kajonggtest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/kajonggtest.py b/src/kajonggtest.py
index cfd03bd..7e74762 100755
--- a/src/kajonggtest.py
+++ b/src/kajonggtest.py
@@ -106,6 +106,7 @@ class Server(StrMixin):
"""represents a kajongg server instance. Called when we want to start a job."""
servers = []
+ count = 0
def __new__(cls, job):
"""can we reuse an existing server?"""
@@ -166,9 +167,11 @@ class Server(StrMixin):
self.portNumber = random.randrange(1025, 65000)
cmd.append('--port={port}'.format(port=self.portNumber))
else:
+ Server.count += 1
self.socketName = os.path.expanduser(
os.path.join('~', '.kajongg',
- 'sock{id}.{rnd}'.format(id=id(self), rnd=random.randrange(10000000))))
+ 'sock{commit}.py{py}.{ctr}'.format(
+ commit=self.commitId, py=self.pythonVersion, ctr=Server.count)))
cmd.append('--socket={sock}'.format(sock=self.socketName))
if OPTIONS.debug:
cmd.append('--debug={dbg}'.format(dbg=','.join(OPTIONS.debug)))