9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import json |
12 import json |
13 |
13 |
14 from PyQt5.QtCore import pyqtSlot, QProcess, QProcessEnvironment |
14 from PyQt5.QtCore import pyqtSlot, QProcess, QProcessEnvironment, \ |
|
15 QCoreApplication |
15 from PyQt5.QtNetwork import QTcpServer, QHostAddress |
16 from PyQt5.QtNetwork import QTcpServer, QHostAddress |
16 |
17 |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
18 |
19 |
19 import Preferences |
20 import Preferences |
71 connection = self.nextPendingConnection() |
72 connection = self.nextPendingConnection() |
72 if not connection.isValid(): |
73 if not connection.isValid(): |
73 return |
74 return |
74 |
75 |
75 if self.__multiplex: |
76 if self.__multiplex: |
76 if not connection.waitForReadyRead(3000): |
77 if not connection.waitForReadyRead(1000): |
77 return |
78 return |
78 idString = bytes(connection.readLine()).decode( |
79 idString = bytes(connection.readLine()).decode( |
79 "utf-8", 'backslashreplace').strip() |
80 "utf-8", 'backslashreplace').strip() |
80 if idString in self.__connections: |
81 if idString in self.__connections: |
81 self.__connections[idString].close() |
82 self.__connections[idString].close() |
239 if not proc.waitForStarted(10000): |
240 if not proc.waitForStarted(10000): |
240 proc = None |
241 proc = None |
241 |
242 |
242 if idString: |
243 if idString: |
243 self.__clientProcesses[idString] = proc |
244 self.__clientProcesses[idString] = proc |
|
245 # wait until the client has connected (= slow start) |
|
246 while not idString in self.__connections: |
|
247 QCoreApplication.processEvents() |
244 else: |
248 else: |
245 self.__clientProcess = proc |
249 self.__clientProcess = proc |
246 |
250 |
247 return proc is not None |
251 return proc is not None |
248 |
252 |