Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
)?;
}
+ let check_batch = {
+ let mtu = self.mtu;
+ move |max_batch, key| {
+ if max_batch/2 < mtu {
+ throw!(anyhow!("max batch {:?} ({}) must be >= 2 x mtu ({}) \
+ (to allow for SLIP ESC-encoding)",
+ key, max_batch, mtu))
+ }
+ Ok::<_,AE>(())
+ }
+ };
+
match end {
LinkEnd::Client => {
if &self.url == &default::<Uri>() {
})
.parse().unwrap()
}
+
+ check_batch(self.max_batch_up, "max_batch_up")?;
},
LinkEnd::Server => {
if self.addrs.is_empty() {
throw!(anyhow!("missing 'addrs' setting"))
}
+ check_batch(self.max_batch_down, "max_batch_down")?;
},
}