Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

endpoints.py 899B

12345678910111213141516171819202122
  1. def build_endpoint_description_strings(
  2. host=None, port=None, unix_socket=None, file_descriptor=None
  3. ):
  4. """
  5. Build a list of twisted endpoint description strings that the server will listen on.
  6. This is to streamline the generation of twisted endpoint description strings from easier
  7. to use command line args such as host, port, unix sockets etc.
  8. """
  9. socket_descriptions = []
  10. if host and port is not None:
  11. host = host.strip("[]").replace(":", r"\:")
  12. socket_descriptions.append("tcp:port=%d:interface=%s" % (int(port), host))
  13. elif any([host, port]):
  14. raise ValueError("TCP binding requires both port and host kwargs.")
  15. if unix_socket:
  16. socket_descriptions.append("unix:%s" % unix_socket)
  17. if file_descriptor is not None:
  18. socket_descriptions.append("fd:fileno=%d" % int(file_descriptor))
  19. return socket_descriptions