diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-13 11:43:37 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-14 12:06:33 +0100 |
commit | 5bca14e72c204b31424069ad0090aefa76071e8c (patch) | |
tree | ce00b14ed66436d7175ce04b0ce48f1b89e97c3f /randport | |
parent | 607f62ae6bc8f684095e447569cff27ba7c8a5dd (diff) | |
download | qvisqve-5bca14e72c204b31424069ad0090aefa76071e8c.tar.gz |
Fix: start Salami
This is based on Qvarn, because the implementation is so similar to
hat Salami needs. This commit drops the unwanted bits of Qvarn and
changes things to be Salami instead.
This commit only introduces the /version endpoint.
Diffstat (limited to 'randport')
-rwxr-xr-x | randport | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/randport b/randport deleted file mode 100755 index d523401..0000000 --- a/randport +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python3 -# -# Copyright (C) 2017 Lars Wirzenius -# -# Pick a random port that is free to be listened on. For testing. - - -import errno -import random -import socket -import sys - - -MAX = 1000 -for i in range(MAX): - port = random.randint(1025, 2**15-1) - s = socket.socket() - try: - s.bind(('0.0.0.0', port)) - except OSError as e: - if e.errno == errno.EADDRINUSE: - continue - raise - break -else: - sys.stderr.write("Can't find a free port\n") - sys.exit(1) -sys.stdout.write('{}\n'.format(port)) |