54 self.runningJob = [None, None, None, None] |
54 self.runningJob = [None, None, None, None] |
55 self.__queue = [] |
55 self.__queue = [] |
56 self.services = {} |
56 self.services = {} |
57 |
57 |
58 networkInterface = Preferences.getDebugger("NetworkInterface") |
58 networkInterface = Preferences.getDebugger("NetworkInterface") |
59 if networkInterface == "all" or "." in networkInterface: |
59 if networkInterface in ("allv4", "localv4") or "." in networkInterface: |
60 self.hostAddress = "127.0.0.1" |
60 # IPv4 |
|
61 self.__hostAddress = "127.0.0.1" |
|
62 elif networkInterface in ("all", "allv6", "localv6"): |
|
63 # IPv6 |
|
64 self.__hostAddress = "::1" |
61 else: |
65 else: |
62 self.hostAddress = "::1" |
66 self.__hostAddress = networkInterface |
63 self.listen(QHostAddress(self.hostAddress)) |
67 self.listen(QHostAddress(self.__hostAddress)) |
64 |
68 |
65 self.newConnection.connect(self.on_newConnection) |
69 self.newConnection.connect(self.on_newConnection) |
66 |
70 |
|
71 ## Note: Need the address and port if started external in debugger: |
67 port = self.serverPort() |
72 port = self.serverPort() |
68 ## Note: Need the port if started external in debugger: |
73 hostAddressStr = ( |
69 print("Background Service listening on: {0:d}".format(port)) |
74 "[{0}]".format(self.__hostAddress) |
70 # __IGNORE_WARNING__ |
75 if ":" in self.__hostAddress |
|
76 else self.__hostAddress |
|
77 ) |
|
78 print("Background Service listening on: {0}:{1:d}".format(hostAddressStr, port)) |
|
79 # __IGNORE_WARNING_M801__ |
71 |
80 |
72 interpreter = self.__getPythonInterpreter() |
81 interpreter = self.__getPythonInterpreter() |
73 if interpreter: |
82 if interpreter: |
74 process = self.__startExternalClient(interpreter, port) |
83 process = self.__startExternalClient(interpreter, port) |
75 if process: |
84 if process: |
110 ) |
119 ) |
111 proc = QProcess(self) |
120 proc = QProcess(self) |
112 proc.setProcessChannelMode(QProcess.ProcessChannelMode.ForwardedChannels) |
121 proc.setProcessChannelMode(QProcess.ProcessChannelMode.ForwardedChannels) |
113 args = [ |
122 args = [ |
114 backgroundClient, |
123 backgroundClient, |
115 self.hostAddress, |
124 self.__hostAddress, |
116 str(port), |
125 str(port), |
117 str(Preferences.getUI("BackgroundServiceProcesses")), |
126 str(Preferences.getUI("BackgroundServiceProcesses")), |
118 Globals.getPythonLibraryDirectory(), |
127 Globals.getPythonLibraryDirectory(), |
119 ] |
128 ] |
120 proc.start(interpreter, args) |
129 proc.start(interpreter, args) |