mirror of
https://github.com/progval/irctest.git
synced 2025-04-05 23:09:48 +00:00
unrealircd: Move SSL and port generation out of the critical section (#196)
This commit is contained in:
@ -223,44 +223,44 @@ class UnrealircdController(BaseServerController, DirectoryBasedController):
|
|||||||
|
|
||||||
password_field = 'password "{}";'.format(password) if password else ""
|
password_field = 'password "{}";'.format(password) if password else ""
|
||||||
|
|
||||||
with _STARTSTOP_LOCK():
|
(services_hostname, services_port) = self.get_hostname_and_port()
|
||||||
(services_hostname, services_port) = self.get_hostname_and_port()
|
(unused_hostname, unused_port) = self.get_hostname_and_port()
|
||||||
(unused_hostname, unused_port) = self.get_hostname_and_port()
|
|
||||||
|
|
||||||
self.gen_ssl()
|
self.gen_ssl()
|
||||||
if ssl:
|
if ssl:
|
||||||
(tls_hostname, tls_port) = (hostname, port)
|
(tls_hostname, tls_port) = (hostname, port)
|
||||||
(hostname, port) = (unused_hostname, unused_port)
|
(hostname, port) = (unused_hostname, unused_port)
|
||||||
else:
|
else:
|
||||||
# Unreal refuses to start without TLS enabled
|
# Unreal refuses to start without TLS enabled
|
||||||
(tls_hostname, tls_port) = (unused_hostname, unused_port)
|
(tls_hostname, tls_port) = (unused_hostname, unused_port)
|
||||||
|
|
||||||
assert self.directory
|
assert self.directory
|
||||||
|
|
||||||
with self.open_file("unrealircd.conf") as fd:
|
with self.open_file("unrealircd.conf") as fd:
|
||||||
fd.write(
|
fd.write(
|
||||||
TEMPLATE_CONFIG.format(
|
TEMPLATE_CONFIG.format(
|
||||||
hostname=hostname,
|
hostname=hostname,
|
||||||
port=port,
|
port=port,
|
||||||
services_hostname=services_hostname,
|
services_hostname=services_hostname,
|
||||||
services_port=services_port,
|
services_port=services_port,
|
||||||
tls_hostname=tls_hostname,
|
tls_hostname=tls_hostname,
|
||||||
tls_port=tls_port,
|
tls_port=tls_port,
|
||||||
password_field=password_field,
|
password_field=password_field,
|
||||||
key_path=self.key_path,
|
key_path=self.key_path,
|
||||||
pem_path=self.pem_path,
|
pem_path=self.pem_path,
|
||||||
empty_file=self.directory / "empty.txt",
|
empty_file=self.directory / "empty.txt",
|
||||||
set_v6only=set_v6only,
|
set_v6only=set_v6only,
|
||||||
extras=extras,
|
extras=extras,
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if faketime and shutil.which("faketime"):
|
if faketime and shutil.which("faketime"):
|
||||||
faketime_cmd = ["faketime", "-f", faketime]
|
faketime_cmd = ["faketime", "-f", faketime]
|
||||||
self.faketime_enabled = True
|
self.faketime_enabled = True
|
||||||
else:
|
else:
|
||||||
faketime_cmd = []
|
faketime_cmd = []
|
||||||
|
|
||||||
|
with _STARTSTOP_LOCK():
|
||||||
self.proc = subprocess.Popen(
|
self.proc = subprocess.Popen(
|
||||||
[
|
[
|
||||||
*faketime_cmd,
|
*faketime_cmd,
|
||||||
|
Reference in New Issue
Block a user