advance-practice/frame #884
Replies: 4 comments 4 replies
-
请问如果缓冲区容量很大 那么要等到缓冲区满了才往socket写数据 是否会导致客户端一直等待 |
Beta Was this translation helpful? Give feedback.
-
在解析完成后,利用advance来将缓冲区该帧数据删除。这个地方我没有很理解。我们现在有一个BufMut, read_buf会写入并且update内部游标。而我们解析完数据后,调用advance也会update内部游标。这里的游标和read_buf 中的游标一样吗?感觉需要两个游标,一个标记当前的读入位置,一个标记当前的写入位置 |
Beta Was this translation helpful? Give feedback.
-
flowchart TD
Start[parse_frame] --> A
A{check} -->|yes| B(get_line)
B -. set_position .-> C(Frame::parse)
C --> End["buffer.advance(len)"]
A --> |no| D(stream.read_buf)
subgraph ReadBuf
D -. poll .-> I["reader poll_read"]
end
subgraph BytesMut
I --> H(["advance_mut"])
end
|
Beta Was this translation helpful? Give feedback.
-
求问这里: if 0 == self.stream.read_buf(&mut self.buffer).await? { |
Beta Was this translation helpful? Give feedback.
-
advance-practice/frame
https://course.rs/advance-practice/frame.html
Beta Was this translation helpful? Give feedback.
All reactions