Code Monkey home page Code Monkey logo

Comments (4)

driftluo avatar driftluo commented on July 24, 2024

我认为这应该是一个实现错误

StreamState::RemoteClosing => {
debug!("closed(EOF)");
let _ignore = self.send_close();
Err(io::ErrorKind::UnexpectedEof.into())

根据约定,这里应该返回 Ok(0)

Poll::Ready(Ok(())) means that data was immediately read and placed into the output buffer. The amount of data read can be determined by the increase in the length of the slice returned by ReadBuf::filled. If the difference is 0, EOF has been reached.

from tentacle.

moeshinyo avatar moeshinyo commented on July 24, 2024

或许可以在这里把状态切换到Closed

https://github.com/nervosnetwork/tentacle/blob/master/yamux/src/stream.rs#L180-L190

接受pr吗?我晚点可以试试修一下。

from tentacle.

moeshinyo avatar moeshinyo commented on July 24, 2024

看了下Spec和Go的实现,收到FIN后需要再发一个FIN回去,那应该在这里将Ok(0)传播出poll_read就行了。

Err(io::ErrorKind::UnexpectedEof.into())

from tentacle.

driftluo avatar driftluo commented on July 24, 2024

或许可以在这里把状态切换到Closed?
https://github.com/nervosnetwork/tentacle/blob/master/yamux/src/stream.rs#L180-L190

这个是错的,yamux 有半关状态,直接切换是不行的

接受pr吗?我晚点可以试试修一下。

当然接受,如果有兴趣的话可以尝试一下,需要带上一个测试用例,类似这个

fn test_drop_with_state_reset() {

看了下Spec和Go的实现,收到FIN后需要再发一个FIN回去,那应该在这里将Ok(0)传播出poll_read就行了。

对,修法很简单,将这个函数拆开,在 RemoteClosing 的分支直接返回 Poll(Ok(()) 就可以了

from tentacle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.