-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Replaced GAIResolver with twisted.names.client for the default resolver #5053
Changes from all commits
3354a08
c138c7a
f4a6ab2
c0aff07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Replace blocking getaddrinfo hostname resolver with the non-blocking resolver from twisted.names.client. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,12 @@ pid_file: DATADIR/homeserver.pid | |
# | ||
#cpu_affinity: 0xFFFFFFFF | ||
|
||
# Whether to use the default system resolver (getaddrinfo) instead of the twisted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that this is a generated file (the script to update it is |
||
# asynchronous dns resolver. Using the async resolver can potentially improve | ||
# performance, but may also behave different from getaddrinfo. | ||
# Defaults to True. Uncomment to use the twisted resolver instead. | ||
#use_getaddrinfo_for_dns: False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while you're changing the source, please could you add a line with just |
||
|
||
# The path to the web client which will be served at /_matrix/client/ | ||
# if 'webclient' is configured under the 'listeners' configuration. | ||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import psutil | ||
from daemonize import Daemonize | ||
|
||
import twisted.names | ||
from twisted.internet import defer, error, reactor | ||
from twisted.protocols.tls import TLSMemoryBIOFactory | ||
|
||
|
@@ -70,6 +71,7 @@ def start_worker_reactor(appname, config): | |
daemonize=config.worker_daemonize, | ||
cpu_affinity=config.worker_cpu_affinity, | ||
print_pidfile=config.print_pidfile, | ||
use_getaddrinfo_for_dns=config.use_getaddrinfo_for_dns, | ||
logger=logger, | ||
) | ||
|
||
|
@@ -82,6 +84,7 @@ def start_reactor( | |
daemonize, | ||
cpu_affinity, | ||
print_pidfile, | ||
use_getaddrinfo_for_dns, | ||
logger, | ||
): | ||
""" Run the reactor in the main process | ||
|
@@ -96,6 +99,7 @@ def start_reactor( | |
pid_file (str): name of pid file to write to if daemonize is True | ||
daemonize (bool): true to run the reactor in a background process | ||
cpu_affinity (int|None): cpu affinity mask | ||
use_getaddrinfo_for_dns (bool): use getaddrinfo instead of async resolver | ||
print_pidfile (bool): whether to print the pid file, if daemonize is True | ||
logger (logging.Logger): logger instance to pass to Daemonize | ||
""" | ||
|
@@ -127,6 +131,10 @@ def run(): | |
change_resource_limit(soft_file_limit) | ||
if gc_thresholds: | ||
gc.set_threshold(*gc_thresholds) | ||
|
||
if use_getaddrinfo_for_dns: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. surely this condition is reversed? |
||
reactor.installResolver(twisted.names.client) | ||
|
||
reactor.run() | ||
|
||
if daemonize: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(could call this a
feature
rather than amisc
?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, feel free to add yourself as a contributor here, along the lines of the other entries in CHANGES.md.