do not reuse address on Windows

socketserver.ThreadingTCPServer.allow_reuse_address must be False on
Windows systems, else several servers might be started on the same
port, and unspecified behaviour will happen

Fixes: #4695
Change-Id: Ic9f193e23854f9cd3413ab6e664ca8029a7c9c76
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30523
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Georg Brandl <g.brandl@fz-juelich.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2023-02-27 12:35:19 +01:00
parent a66f2ac21b
commit 0ce5a495f0

View File

@ -27,6 +27,7 @@ import sys
import threading import threading
import time import time
import errno import errno
import os
from frappy.datatypes import BoolType, StringType from frappy.datatypes import BoolType, StringType
from frappy.errors import SECoPError from frappy.errors import SECoPError
@ -169,7 +170,9 @@ class TCPRequestHandler(socketserver.BaseRequestHandler):
class TCPServer(socketserver.ThreadingTCPServer): class TCPServer(socketserver.ThreadingTCPServer):
daemon_threads = True daemon_threads = True
allow_reuse_address = True # on windows, 'reuse_address' means that several servers might listen on
# the same port, on the other hand, a port is not blocked after closing
allow_reuse_address = os.name != 'nt' # False on Windows systems
# for cfg-editor # for cfg-editor
configurables = { configurables = {