Comments (11)
应该不会有问题, 你多 debug 一下。
如果还有问题,发下完整源码,我运行看看。
类型断言 最好采用这种方式:
value, ok := a.(string)
from gev.
这种类型的连接和断开也运行了至少上百次了 ,也才遇到这一次panic,从这个业务代码上看起来明明是设置了context的,怎么取出来就是空的呢
刚刚我又看了一下,正常情况下 OnConnect的时候会执行
c.Send([]byte("fvpvTbKVC\\WnpqQvh_xdY\\\\"))
但是崩溃的这次看起来还没来得急执行OnConnect回调里面的Send这串数据,就执行OnClose回调函数关闭连接了
下面这个是正常情况的日志
[Realm]2019/12/12 20:12:37 Listening at *:7000
[World]2019/12/12 20:12:37 Listening at *:7400
[Realm]2019/12/12 20:13:03 New Connection from: 192.168.1.201:12132
[Core ]2019/12/12 20:13:03 Send: fvpvTbKVC\WnpqQvh_xdY\\
[Realm]2019/12/12 20:13:03 Connection closed from: 192.168.1.201:12132
这里是protocol里面的Packet函数
func (p *Protocol) Packet(c *connection.Connection, data []byte) []byte {
log.Core.Printf("Send: %s", string(data))
return data
}
from gev.
Line 102 in a71b547
我大概猜测到原因,执行 onConnect 时机的问题,onConnect 是在加入 epoll 之后执行,并且不是在 IO 线程执行。
可能是 刚好加入 epoll 后,在 onConnect 回调之前,客户端断开了链接,IO 线程就直接调用了 onClose 回调。
from gev.
fix
from gev.
好的 3q 那我继续玩
from gev.
好的 3q 那我继续玩
from gev.
好的 3q 那我继续玩
好的,感谢报 bug
怎么更新不了呢? 是不是需要你这边怎么发布一下?
from gev.
好的 3q 那我继续玩
好的,感谢报 bug
怎么更新不了呢? 是不是需要你这边怎么发布一下?
发布了
https://github.com/Allenxuxu/gev/releases/tag/v0.1.5
from gev.
老哥,拉这个最新的试下:
https://github.com/Allenxuxu/gev/releases/tag/v0.1.8
from gev.
老哥,拉这个最新的试下:
https://github.com/Allenxuxu/gev/releases/tag/v0.1.8
好像没啥问题了
from gev.
老哥,拉这个最新的试下:
https://github.com/Allenxuxu/gev/releases/tag/v0.1.8好像没啥问题了
感谢老哥帮忙测试!
from gev.
Related Issues (20)
- ring buffer在高在线量场景可能导致高内存占用 HOT 4
- unix.POLLHUP=0x10,这里为什么或(|)上0x80啊? HOT 1
- default protocol bug HOT 3
- 这里为什么是一个循环啊??? HOT 2
- How to use with gin HOT 1
- 事件处理顺序如何排序,这里的排序有什么讲究? HOT 4
- Are the writes to socket blocking or non-blocking? HOT 3
- 这里的循环是不是换成if也行 HOT 2
- 请教一个问题,实在没看懂。 HOT 4
- 关闭连接时,为什么不直接关闭连接,而是将【关闭连接】这个任务放到异步队列里面等待执行? HOT 3
- 请问一下该库能管理大量客户端连接么? HOT 1
- 对于gev的一些疑问 HOT 1
- 控制EpollWait的msec优势在哪?
- EpollWait循环中wakeHandlerRead()是不是处理早了 HOT 1
- 建议加入UDP协议 HOT 1
- 百兆数据传输效率 HOT 2
- Question: is it possible to use your module as a websocket client? HOT 1
- OnConnect 里使用 c.set 的请教! HOT 1
- 能不能加一个sproto支持啊?
- 是否应该加入高水位回调来避免客户端不收数据
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 gev.