From 70cabfa89c450a9479a3285c4e4d52a8732c1071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Wed, 13 Apr 2022 23:45:39 +0200 Subject: [PATCH] udp: ConnectionValidator: add anyhow context to getrandom call --- aquatic_udp/src/common.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aquatic_udp/src/common.rs b/aquatic_udp/src/common.rs index 2249961..6609914 100644 --- a/aquatic_udp/src/common.rs +++ b/aquatic_udp/src/common.rs @@ -5,6 +5,7 @@ use std::sync::atomic::AtomicUsize; use std::sync::Arc; use std::time::Instant; +use anyhow::Context; use crossbeam_channel::{Sender, TrySendError}; use getrandom::getrandom; @@ -27,7 +28,7 @@ impl ConnectionValidator { pub fn new(config: &Config) -> anyhow::Result { let mut key = [0; 32]; - getrandom(&mut key)?; + getrandom(&mut key).with_context(|| "Couldn't get random bytes from system source")?; let hmac = blake3::Hasher::new_keyed(&key);