4747# The system will recommend disconnecting after missing TIMEOUT PINGs.
4848# Exact timing depends on CHECK_FOR_TIMEOUTS_INTERVAL variable in base_station_tick()
4949"""
50- from constants import TIMEOUT
50+ from constants import TIMEOUT , bUEs
5151
5252
5353# Internal imports
@@ -195,15 +195,15 @@ def message_listener(self):
195195 else :
196196 logger .error (f"Got a connection request from { bue_id } but it is already listed as connected" )
197197
198- if message_body .startswith ("ACK" ):
198+ elif message_body .startswith ("ACK" ):
199199 logger .bind (bue_id = bue_id ).info (f"Received ACK from { bue_id } " )
200200
201- if message_body .startswith ("PING" ): # Looks like <origin id>,PING,<lat>,<long>
201+ elif message_body .startswith ("PING" ): # Looks like <origin id>,PING,<lat>,<long>
202202 header , lat , long = message_body .split ("," )
203203 print (f"header: { header } , lat: { lat } , long: { long } " , flush = True )
204204 self .ping_bue (bue_id , lat , long )
205205
206- if message_body .startswith ("UPD" ): # 40,55,UPD:LAT,LONG,STDOUT: [helloworld.py STDOUT] TyGoodTest,-42,8
206+ elif message_body .startswith ("UPD" ): # 40,55,UPD:LAT,LONG,STDOUT: [helloworld.py STDOUT] TyGoodTest,-42,8
207207 if not bue_id in self .testing_bues :
208208 self .testing_bues .append (bue_id )
209209 header , lat , long , stdout = message_body .split ("," )
@@ -219,21 +219,24 @@ def message_listener(self):
219219 if stdout != "" :
220220 self .stdout_history .append (stdout )
221221
222- if message_body .startswith ("FAIL" ):
222+ elif message_body .startswith ("FAIL" ):
223223 logger .bind (bue_id = bue_id ).error (f"Received FAIL from { bue_id } " )
224224 self .testing_bues .remove (bue_id )
225225
226- if message_body .startswith ("DONE" ):
226+ elif message_body .startswith ("DONE" ):
227227 logger .bind (bue_id = bue_id ).info (f"Received DONE from { bue_id } " )
228228 self .testing_bues .remove (bue_id )
229229
230- if message_body .startswith ("PREPR" ):
230+ elif message_body .startswith ("PREPR" ):
231231 logger .bind (bue_id = bue_id ).info (f"Received PREPR from { bue_id } " )
232232 self .testing_bues .append (bue_id )
233233
234- if message_body .startswith ("CANCD" ):
234+ elif message_body .startswith ("CANCD" ):
235235 logger .bind (bue_id = bue_id ).info (f"Received CANCD from { bue_id } " )
236236 self .testing_bues .remove (bue_id )
237+ elif message_body .startswith ("BAD" ):
238+ logger .bind (bue_id = bue_id ).info (f"Received BAD from { bue_id } " )
239+ self .stdout_history .append (f"Received a BAD from { bUEs [str (bue_id )]} " )
237240
238241 else :
239242 logger .info (f"Received undefined message { message } " )
0 commit comments