256 # connection of the client (= slow start). |
256 # connection of the client (= slow start). |
257 QCoreApplication.processEvents( |
257 QCoreApplication.processEvents( |
258 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
258 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
259 |
259 |
260 # check if client exited prematurely |
260 # check if client exited prematurely |
261 state = proc.state() |
261 if proc.state() == QProcess.ProcessState.NotRunning: |
262 if state == QProcess.ProcessState.NotRunning: |
|
263 exitCode = proc.exitCode() |
262 exitCode = proc.exitCode() |
264 proc = None |
263 proc = None |
265 self.__clientProcesses[idString] = None |
264 self.__clientProcesses[idString] = None |
266 break |
265 break |
267 else: |
266 else: |
|
267 if proc: |
|
268 timer = QTimer() |
|
269 timer.setSingleShot(True) |
|
270 timer.start(1000) # 1s timeout |
|
271 while timer.isActive(): |
|
272 # check if client exited prematurely |
|
273 QCoreApplication.processEvents( |
|
274 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
|
275 if proc.state() == QProcess.ProcessState.NotRunning: |
|
276 exitCode = proc.exitCode() |
|
277 proc = None |
|
278 break |
268 self.__clientProcess = proc |
279 self.__clientProcess = proc |
269 |
280 |
270 return proc is not None, exitCode |
281 return proc is not None, exitCode |
271 |
282 |
272 def stopClient(self, idString=""): |
283 def stopClient(self, idString=""): |