eric6/Utilities/BackgroundService.py

branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 6942
2602857055c5
child 7229
53054eb5b15a
equal deleted inserted replaced
7191:960850ec284c 7192:a22eee00b052
137 # Reset flag and continue processing queue 137 # Reset flag and continue processing queue
138 self.isWorking = None 138 self.isWorking = None
139 self.__processQueue() 139 self.__processQueue()
140 else: 140 else:
141 packedData = json.dumps([fx, fn, data]) 141 packedData = json.dumps([fx, fn, data])
142 if sys.version_info[0] == 3: 142 packedData = bytes(packedData, 'utf-8')
143 packedData = bytes(packedData, 'utf-8')
144 header = struct.pack( 143 header = struct.pack(
145 b'!II', len(packedData), adler32(packedData) & 0xffffffff) 144 b'!II', len(packedData), adler32(packedData) & 0xffffffff)
146 connection.write(header) 145 connection.write(header)
147 connection.write(b'JOB ') # 6 character message type 146 connection.write(b'JOB ') # 6 character message type
148 connection.write(packedData) 147 connection.write(packedData)
169 connection.waitForReadyRead(50) 168 connection.waitForReadyRead(50)
170 packedData += connection.read(maxSize) 169 packedData += connection.read(maxSize)
171 170
172 assert adler32(packedData) & 0xffffffff == datahash, \ 171 assert adler32(packedData) & 0xffffffff == datahash, \
173 'Hashes not equal' 172 'Hashes not equal'
174 if sys.version_info[0] == 3: 173 packedData = packedData.decode('utf-8')
175 packedData = packedData.decode('utf-8')
176 # "check" if is's a tuple of 3 values 174 # "check" if is's a tuple of 3 values
177 fx, fn, data = json.loads(packedData) 175 fx, fn, data = json.loads(packedData)
178 176
179 if fx == 'INIT': 177 if fx == 'INIT':
180 pass 178 pass
383 """ 381 """
384 connection = self.nextPendingConnection() 382 connection = self.nextPendingConnection()
385 if not connection.waitForReadyRead(1000): 383 if not connection.waitForReadyRead(1000):
386 return 384 return
387 lang = connection.read(64) 385 lang = connection.read(64)
388 if sys.version_info[0] == 3: 386 lang = lang.decode('utf-8')
389 lang = lang.decode('utf-8')
390 # Avoid hanging of eric on shutdown 387 # Avoid hanging of eric on shutdown
391 if self.connections.get(lang): 388 if self.connections.get(lang):
392 self.connections[lang].close() 389 self.connections[lang].close()
393 if self.isWorking == lang: 390 if self.isWorking == lang:
394 self.isWorking = None 391 self.isWorking = None

eric ide

mercurial