Giter VIP home page Giter VIP logo

netman's Issues

TLS:fd没有设置nonblock,poller循环存在类似线头阻塞的问题(v站看到楼主介绍,来看一眼)

由于是阻塞模式、直接使用标准库的tls handshak,并且后续暂时也没有把后续都改为非阻塞,所以tls模式下,每个连接仍然是阻塞的慢操作,并且tls的握手流程本身就多步骤,这对于连接数稍微多一些的服务,公网或者慢连接很容易就会遇到half-packet、连接质量不佳时,部分连接会导致其他连接都等待,这是不能接受的

提供异步非阻塞接口的框架,关键在于实现nonblock+异步流解析器,之前有个老外的ws百万连接,使用easy go,也是跟netman现在处理tls的方式类似,只是把fd的事件用poller管理起来了,并没有使用非阻塞、实现异步流解析器,这种都是不太能满足高并发、高性能服务器的需要的

ps,因为我自己也写了一个nbio,所以对这种同类项目都比较关注,欢迎多多交流

TLS相关

baseconnect.go这个文件中

_```
// Read 读取数据
func (c *BaseConnect) Read(bs []byte) (int, error) {

n, err := unix.Read(c.fd, bs)

// 已完成了TLS握手
if c.handshakeCompleted {
	if n >= 0 {
		c.tlsRawSize += n
	}
}

想问下,if c.handshakeCompleted后计算收到的业务数据长度。有没有一种可能性,就是在握手结束时最后一次Read会读取部分业务数据?

关于tls的建议

看到example的tls只有两个(server.crt server.key)传入参数,但是不是所有证书形式都是文件。希望可以加入server.withTLSconfig(*tls.config)函数

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.