Controller fix.

This commit is contained in:
Adam Ierymenko 2022-12-07 14:17:31 -05:00
parent 57badb6e56
commit 312a14c593
2 changed files with 2 additions and 6 deletions

View file

@ -181,11 +181,7 @@ impl Controller {
packet.append_u16(config_data.len() as u16)?;
packet.append_bytes(config_data.as_slice())?;
// NOTE: V1 supports a bunch of other things like chunking but it was never truly used and is optional.
// Omit it here as it adds overhead and requires an extra signature we don't need since the other side
// knows this packet is coming directly from the controller. This stuff was originally designed to support
// a scatter-gather method of config distribution that was never implemented. V2 will just KISS and do
// controller clustering instead if we need scalability or more fault tolerance.
// TODO: for V1 we may need to introduce use of the chunking mechanism for large configs.
}
let new_payload_len = protocol::compress(&mut packet.as_bytes_mut()[payload_start..]);

View file

@ -57,7 +57,7 @@ impl MulticastAuthority {
) -> PacketHandlerResult {
let mut subscriptions = RMaybeWLockGuard::new_read(&self.subscriptions);
while payload.len() >= (8 + 6 + 4) {
while (cursor + 8 + 6 + 4) <= payload.len() {
let network_id = NetworkId::from_bytes_fixed(payload.read_bytes_fixed(&mut cursor).unwrap());
if let Some(network_id) = network_id {
let mac = MAC::from_bytes_fixed(payload.read_bytes_fixed(&mut cursor).unwrap());