Comments (12)
how to implement SetWriteDeadline(t time.Time) error
for different streams on the same connection?
from smux.
Well yamux does it somehow.
from smux.
but with problem
from smux.
What problem?
I mean it's not feasible to have any networking library if you might end up hanging indefinately or for unreasonable amounts of time (say 30 seconds on a handshake)
from smux.
As for implementation it's trivial, all the deadlines do is promise that next calls will not block for longer than X, no other sematics are implied by that.
from smux.
you have to set the underlying connection's WriteDeadLine to the closest one of all streams, or else, it will block when sockbuf is full.
so a possible solution is by maintaining a min-heap for deadline. when the closest deadline has reached, switch to the next one.
from smux.
I think it's perfectly fine to discard data at some later point (after the write has returned), the idea is just not to block on the write for too long, if the send queue is full or something like that.
from smux.
you can't guarantee that if you do not set write deadline to for example TCPConn.
from smux.
Well I suspect it's fine for the dispatching routine to block indefinately or to maintain a continious 1s deadline itself internally, yet it doesn't need to be related to the deadline of the stream.
from smux.
I guess you need a deadline for Accept() on the session for example.
from smux.
continuous 1s interrupt doesn't guarantee the atomicity of conn.Write for various underlying connections , you have to handle 'wrote incomplete data' problem, especially for TCPConn.
from smux.
Fine, you can probably get away without a deadline there as the write call would return upon a close of tye connection anyway, not causing any routine leaks.
from smux.
Related Issues (20)
- Unnecessary keepalive frames HOT 4
- Serious keepalive issue HOT 6
- 修正一处细节, HOT 4
- Blocked streams under heavy load HOT 5
- smux multiplexes multiple TCP connections?
- Stream does not return net.Error for timeouts
- alloc module memory release HOT 1
- What's the difference between version1 and version2 in smux.Config? HOT 4
- cmdFIN and cmdPSH race condition HOT 2
- 如何检测一个 Conn 是否 muxing?
- proposal: add option to not close idle session HOT 1
- 一个stream不读数据,另一端stream一直写,直到缓冲满。这个时候绑定在conn上的Session将不能执行任何指令。 HOT 4
- 写超时,应用层选择重发 HOT 1
- 看了好多遍都没看懂,这个地方没有错误吗 HOT 15
- TestGetDieCh() strange behaviour seems cause by racing
- 建议增加一个 Session.GetCloseChan() 的函数,可以使用select快速得知连接已经被断开 HOT 6
- An extra character appears when using io.Copy
- 想问下协议版本1和2有什么区别 HOT 5
- 能否支持自动匹配客户端版本 (version 1,2) HOT 2
- Multiplexing over SCTP unordered mode HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smux.