Use a different port for test mode.

This commit is contained in:
Jacob Hoffman-Andrews 2015-05-21 19:08:05 -07:00
parent 233d1fb7f6
commit e1e6135313

View file

@ -378,7 +378,10 @@ class StandaloneAuthenticator(common.Plugin):
results_if_failure.append(False)
if not self.tasks:
raise ValueError("nothing for .perform() to do")
if self.already_listening(challenges.DVSNI.PORT):
port = challenges.DVSNI.PORT
if self.config.test_mode:
port = 5001
if self.already_listening(port):
# If we know a process is already listening on this port,
# tell the user, and don't even attempt to bind it. (This
# test is Linux-specific and won't indicate that the port
@ -386,7 +389,7 @@ class StandaloneAuthenticator(common.Plugin):
return results_if_failure
# Try to do the authentication; note that this creates
# the listener subprocess via os.fork()
if self.start_listener(challenges.DVSNI.PORT, key):
if self.start_listener(port, key):
return results_if_success
else:
# TODO: This should probably raise a DVAuthError exception