diff options
author | Jorik Schellekens <joriks@matrix.org> | 2019-09-05 11:48:07 +0100 |
---|---|---|
committer | Jorik Schellekens <joriks@matrix.org> | 2019-09-05 11:48:23 +0100 |
commit | d934837b48fd493d85f96c10adb69cdf8f4badb7 (patch) | |
tree | 0bfe4bbdc6a2ef4b58e3bbacce18b20561a5f7b2 /synapse_topology | |
parent | Priv ports not working (diff) | |
download | synapse-d934837b48fd493d85f96c10adb69cdf8f4badb7.tar.xz |
Fix port in use
Diffstat (limited to 'synapse_topology')
-rw-r--r-- | synapse_topology/server/utils.py | 3 | ||||
-rw-r--r-- | synapse_topology/webui/src/js/components/PortSelection.jsx | 9 |
2 files changed, 3 insertions, 9 deletions
diff --git a/synapse_topology/server/utils.py b/synapse_topology/server/utils.py index 8450f5b6de..b031acc490 100644 --- a/synapse_topology/server/utils.py +++ b/synapse_topology/server/utils.py @@ -27,9 +27,8 @@ def port_checker(port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: try: - sock.bind((socket.gethostname(), port)) + sock.bind(("0.0.0.0", port)) sock.listen() - sock.close() return True except: return False diff --git a/synapse_topology/webui/src/js/components/PortSelection.jsx b/synapse_topology/webui/src/js/components/PortSelection.jsx index c795c5d2db..a2ac1316c6 100644 --- a/synapse_topology/webui/src/js/components/PortSelection.jsx +++ b/synapse_topology/webui/src/js/components/PortSelection.jsx @@ -35,8 +35,6 @@ export default ({ const [clientPortValid, setClientPortValid] = useState(true) const [fedPortValid, setFedPortValid] = useState(true) - const [internalFedPortInUse, setInternalFedPortInUse] = useState(fedPortInUse) - const [internalClientPortInUse, setInternalClientPortInUse] = useState(clientPortInUse) const updateValidity = (port, setValid) => setValid( !isNaN(port) && 0 < port && port <= 65535, @@ -46,7 +44,6 @@ export default ({ const onFederationChange = event => { const val = event.target.value ? event.target.value : defaultFedPort; - setInternalFedPortInUse(false); setFedPort(val); updateValidity(val, setFedPortValid); @@ -55,7 +52,6 @@ export default ({ const onClientChange = event => { const val = event.target.value ? event.target.value : defaultClientPort; - setInternalClientPortInUse(false); setClientPort(val); updateValidity(val, setClientPortValid); @@ -63,12 +59,12 @@ export default ({ const toggle = useAccordionToggle(nextUI(PORT_SELECTION_UI)); - const fedPortError = internalFedPortInUse ? + const fedPortError = fedPortInUse ? "This port is in use" : !fedPortValid ? "Invalid port" : undefined; - const clientPortError = internalClientPortInUse ? + const clientPortError = clientPortInUse ? "This port is in use" : !clientPortValid ? "Invalid port" : undefined; @@ -124,7 +120,6 @@ export default ({ <InlineError error={clientPortError}> <input type="text" - className={internalClientPortInUse | !clientPortValid ? "invalid" : undefined} onChange={onClientChange} disabled={canChangePorts ? undefined : true} autoFocus |