Skip to content

Commit 7375b8f

Browse files
ibigbugcavivie
authored andcommitted
upgrade smoltcp
1 parent 6226047 commit 7375b8f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ etherparse = "0.16"
2323
futures = "0.3"
2424
rand = "0.8"
2525
spin = "0.9"
26-
smoltcp = { version = "0.11", default-features = false, features = [
26+
smoltcp = { version = "0.12", default-features = false, features = [
2727
"std",
2828
"log",
2929
"medium-ip",

src/device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ pub(super) struct VirtualRxToken {
7373
}
7474

7575
impl RxToken for VirtualRxToken {
76-
fn consume<R, F>(mut self, f: F) -> R
76+
fn consume<R, F>(self, f: F) -> R
7777
where
78-
F: FnOnce(&mut [u8]) -> R,
78+
F: FnOnce(&[u8]) -> R,
7979
{
80-
f(&mut self.buffer[..])
80+
f(&self.buffer[..])
8181
}
8282
}
8383

src/tcp.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ impl TcpListenerRunner {
200200

201201
let before_poll = Instant::now();
202202
let updated_sockets = iface.poll(before_poll, &mut device, &mut socket_set);
203-
if updated_sockets {
203+
if matches!(
204+
updated_sockets,
205+
smoltcp::iface::PollResult::SocketStateChanged
206+
) {
204207
trace!("VirtDevice::poll costed {}", Instant::now() - before_poll);
205208
}
206209

@@ -499,6 +502,7 @@ impl AsyncWrite for TcpStream {
499502
cx: &mut Context<'_>,
500503
buf: &[u8],
501504
) -> Poll<std::io::Result<usize>> {
505+
error!("TcpStream::poll_write called with {} bytes", buf.len());
502506
let mut control = self.control.lock();
503507

504508
// If state == Close | Closing | Closed, the TCP stream WR half is closed.

0 commit comments

Comments
 (0)