GithubHelp home page GithubHelp logo

Comments (7)

xtaci avatar xtaci commented on July 1, 2024

完全正确

from smux.

cs8425 avatar cs8425 commented on July 1, 2024

自己嚕的TCP over TCP已踩到這問題...
改成每個stream一個token
加入2個控制封包: full, empty
這樣是否會比較好?
正在改寫中
如果完成後沒問題會提交PR

from smux.

xtaci avatar xtaci commented on July 1, 2024

@cs8425 不清楚你说的每个stream一个token怎么实现,你又无法预知下一个strream id是什么的时候

from smux.

cs8425 avatar cs8425 commented on July 1, 2024

@xtaci
目前大致構想是這樣的:
廢掉Session的token bucket
Stream結構裡面加入token
Session的recvLoop(), cmdPSH的時候檢查Stream的token(假設為A端)
不足的話傳送stream id + full到對面(假設為B端)
block住B端那個stream id的Write
直到A端Read夠多的資料出來(token夠多了)
A端傳送stream id + empty到B端
讓B端的那個stream可以繼續Write
不知道這樣會不會有什麼問題就是

from smux.

xtaci avatar xtaci commented on July 1, 2024

这样stream越多,内存用量越大

from smux.

cs8425 avatar cs8425 commented on July 1, 2024

是的
理想情況下可能還需要一個機制來控制最大同時連線數
不過理論上來說
除非夠多的stream都很慢
而且對面沒收到控制封包block住Write操作
否則記憶體用量應該是可以接受的

from smux.

xtaci avatar xtaci commented on July 1, 2024

https://github.com/xtaci/smux/tree/v2

from smux.

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.