From a5a43e762dd263de3a9af8855d2deb1736853afa Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt-cli/src/command/client.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vnt-cli/src/command/client.rs b/vnt-cli/src/command/client.rs index 0630c79..d524653 100644 --- a/vnt-cli/src/command/client.rs +++ b/vnt-cli/src/command/client.rs @@ -7,7 +7,7 @@ use std::time::Duration; use crate::command::entity::{DeviceItem, Info, RouteItem}; pub struct CommandClient { - buf: [u8; 10240], + buf: Vec, udp: UdpSocket, } @@ -25,7 +25,7 @@ impl CommandClient { )))?; Ok(Self { udp, - buf: [0; 10240], + buf: vec![0; 65536 * 8], }) } } @@ -59,8 +59,16 @@ impl CommandClient { match serde_yaml::from_slice::(&self.buf[..len]) { Ok(val) => Ok(val), Err(e) => { - log::error!("{:?},{:?}", &self.buf[..len], e); - Err(io::Error::new(io::ErrorKind::Other, "data error")) + log::error!( + "send_cmd {:?} {:?},{:?}", + std::str::from_utf8(cmd), + std::str::from_utf8(&self.buf[..len]), + e + ); + Err(io::Error::new( + io::ErrorKind::Other, + format!("data error {:?} buf_len={}", e, len), + )) } } }