Update current network context and handle network changes
(self)
| 173 | return f"net_{network_hash}" |
| 174 | |
| 175 | def update_network_context(self): |
| 176 | """Update current network context and handle network changes""" |
| 177 | try: |
| 178 | new_network = self.get_current_network_id() |
| 179 | |
| 180 | # Check for network change |
| 181 | if new_network != self.current_network: |
| 182 | self.logger.info(f"Network change detected: {self.current_network} -> {new_network}") |
| 183 | |
| 184 | # Handle network change |
| 185 | self.handle_network_change(self.current_network, new_network) |
| 186 | |
| 187 | # Update network context |
| 188 | self.previous_network = self.current_network |
| 189 | self.current_network = new_network |
| 190 | self.network_change_time = datetime.now() |
| 191 | |
| 192 | # Update network profile if we have a valid network |
| 193 | if new_network: |
| 194 | self.update_network_profile(new_network) |
| 195 | |
| 196 | except Exception as e: |
| 197 | self.logger.error(f"Error updating network context: {e}") |
| 198 | |
| 199 | def handle_network_change(self, old_network: Optional[str], new_network: Optional[str]): |
| 200 | """Handle network change by managing finding states""" |
no test coverage detected