Comments (3)
本来就要在写入的时候把要发送的字节数copy到rewriter
以备之后重发, 不如就在写入的线程里, 只把要写的字节数刷到rewriter
里, 然后通知负责flush的线程有数据要发送. flush线程负责从上次刷成功的index开始, 写入剩余未写入的部分. 这样子修改的好处是
- 合并多个小write
- 写线程单线程
- 逻辑简单, 写线程只负责把rewriter里的未发送成功的数据发出去, 重连成功和正常情况是一样的代码. 断线重连就真的只需要断开旧连接, 发起新连接的时候重置上次发送成功的index就可以.
需要额外处理发送得很慢的情况, 逻辑线程要写数据时, 未发送的数据数量超过了rewriter的大小. 可以考虑
- 超过了就直接断线, 有64k(根据配置)的数据没有发成功, 本来就表示这连接有问题
- 也可以临时增加rewriter的大小, 让逻辑线程可以把数据刷进去先返回. rewriter大小达到另一个配置的未发送消息的上限后, 断线
from snet.
@chentmin 请问你们有修复这个问题吗?
from snet.
木有, 偶c#不溜
from snet.
Related Issues (6)
- 协议改进
- IPV6 nat 环境会抛异常 HOT 1
- Conn::tryReconn有一个mutex重入问题 HOT 2
- 这东西能拿来翻墙吗?
- 这个和link库一起使用,是一套怎样的流程 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 snet.