refactor: remove panic on impossible error

Remove the logical complexity of error handling for an error that cannot
occur.

This was an artifact of pre-PR refactoring - the error being returned
SHOULD never be reached, as the only error returned is the "your message
is too big" error, and that's not possible because the message size is
validated in the GossipHandle::broadcast() method before it reaches the
reactor.
pull/24376/head
Dom Dwyer 2023-07-10 14:10:03 +02:00
parent a686580ffa
commit 701da1363c
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
1 changed files with 9 additions and 6 deletions

View File

@ -213,15 +213,18 @@ where
// The user is guaranteed MAX_USER_PAYLOAD_BYTES to
// be send-able, so send this frame without packing
// others with it for simplicity.
if populate_frame(
populate_frame(
&mut self.cached_frame,
vec![new_payload(Payload::UserData(proto::UserPayload{payload}))],
&mut self.serialisation_buf
).is_err()
{
continue
}
self.peer_list.broadcast(&self.serialisation_buf, &self.socket, &self.metric_frames_sent, &self.metric_bytes_sent).await;
).expect("size validated in handle at enqueue time");
self.peer_list.broadcast(
&self.serialisation_buf,
&self.socket,
&self.metric_frames_sent,
&self.metric_bytes_sent
).await;
}
}
}