Skip to content

Releases: luyu6056/gnet

更新go.mod到1.20

19 Apr 04:00
Compare
Choose a tag to compare
更新go.mod到1.20 Pre-release
Pre-release
v1.4.0

更新到go1.20版本

优化平滑热重启

15 Feb 07:29
Compare
Choose a tag to compare

优化平滑热重启

修改unix下写删在epoll内完成

06 Feb 02:39
Compare
Choose a tag to compare

去掉独立的loopout协程
修改conn写删,在epoll内完成
增加一个writetimeout选项

测试了一些其他平台

11 Nov 03:18
Compare
Choose a tag to compare
Pre-release

通过测试的有
windows下的x86
linux下的x86与arm

合并一部分2.0代码

26 Aug 03:54
Compare
Choose a tag to compare
Pre-release

保留1.0api,更新了部分代码

修复mac和windows下的bug

07 Mar 15:03
Compare
Choose a tag to compare
v1.3.7

修复mac与windows下的bug

修复windows下tcp连接close后仍在read导致的nil

21 Feb 02:52
Compare
Choose a tag to compare

增加一个tcpClose结构体,当read出现err之后,传入el.ch并return,以保证tcpClose是在read之后执行,并且tcpClose之后不会在进行read。

修复linux下asyncWrite错误

14 Feb 08:32
Compare
Choose a tag to compare
v1.3.5

修复linux下AsyncWrite没发送Encode

修复linux下dialtcp地址错误

06 Jan 01:44
Compare
Choose a tag to compare
v1.3.4

修复linux下dialtcp地址错误

gnet客户端tcp4实现

17 Dec 03:39
c1c6294
Compare
Choose a tag to compare

使用例子

var GnetClient = gnet.Client(&gnetClient{}, gnet.WithCodec(&RpcCodec{}), gnet.WithTCPNoDelay(true))

func dail(network, addr string, rpc *RpcClient) (net.Conn, error) {
	c, err := GnetClient.Dial(network, addr)
	if err != nil {
		return nil, err
	}
	c.SetContext(rpc)
	conn := newClient(c)

	return conn, err
}

type gnetClient struct {
	*gnet.EventServer
}
func (*RpcClient) handleRead() {

}
func (rs *gnetClient) OnOpened(c gnet.Conn) (out []byte, action gnet.Action) {

	return
}
func (rs *gnetClient) OnClosed(c gnet.Conn, err error) (action gnet.Action) {
	if rpc, ok := c.Context().(*RpcClient); ok {
		rpc.reconnect <- nil
	}
	return gnet.None
}
func (rs *gnetClient) React(data []byte, c gnet.Conn) (action gnet.Action) {
}