eric6/Utilities/BackgroundClient.py

changeset 7628
f904d0eef264
parent 7534
5441fa55cb0d
child 7635
0cdead130a81
equal deleted inserted replaced
7626:7f643d41464e 7628:f904d0eef264
142 return False 142 return False
143 143
144 def run(self): 144 def run(self):
145 """ 145 """
146 Public method implementing the main loop of the client. 146 Public method implementing the main loop of the client.
147
148 @exception RuntimeError raised if hashes don't match
147 """ 149 """
148 try: 150 try:
149 while True: 151 while True:
150 header = self.__receive(struct.calcsize(b'!II')) 152 header = self.__receive(struct.calcsize(b'!II'))
151 # Leave main loop if connection was closed. 153 # Leave main loop if connection was closed.
157 packedData = self.__receive(length) 159 packedData = self.__receive(length)
158 160
159 if messageType != b"JOB ": 161 if messageType != b"JOB ":
160 continue 162 continue
161 163
162 assert adler32(packedData) & 0xffffffff == datahash, \ 164 if adler32(packedData) & 0xffffffff != datahash:
163 'Hashes not equal' 165 raise RuntimeError('Hashes not equal')
166
164 if sys.version_info[0] >= 3: 167 if sys.version_info[0] >= 3:
165 packedData = packedData.decode('utf-8') 168 packedData = packedData.decode('utf-8')
166 169
167 fx, fn, data = json.loads(packedData) 170 fx, fn, data = json.loads(packedData)
168 if fx == 'INIT': 171 if fx == 'INIT':

eric ide

mercurial