cherry-game / cherry Goto Github PK
View Code? Open in Web Editor NEWActor model game server framework based on golang
Home Page: https://cherry-game.github.io
License: MIT License
Actor model game server framework based on golang
Home Page: https://cherry-game.github.io
License: MIT License
WARNING: DATA RACE
Write at 0x00c0001ce828 by goroutine 44:
sync/atomic.StoreInt64()
C:/Program Files/Go/src/runtime/race_amd64.s:237 +0xb
sync/atomic.StoreInt64()
:1 +0x15
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).processPacket()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:266 +0x2b0
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).readChan()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:166 +0x116
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).Run.func2()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:140 +0x33
Previous read at 0x00c0001ce828 by goroutine 43:
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).writeChan()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:192 +0x3a5
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).Run.func1()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:139 +0x33
Goroutine 44 (running) created at:
github.com/cherry-game/cherry/net/parser/pomelo.(*Agent).Run()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/agent.go:140 +0xfc
github.com/cherry-game/cherry/net/parser/pomelo.(*actor).defaultOnConnectFunc()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/parser/pomelo/actor.go:91 +0x446
github.com/cherry-game/cherry/net/parser/pomelo.(*actor).defaultOnConnectFunc-fm()
:1 +0x47
github.com/cherry-game/cherry/net/connector.(*Connector).Start.func1()
D:/Workspace/gopath/pkg/mod/github.com/cherry-game/[email protected]/net/connector/connector.go:45 +0x93
net/parser/pomelo/agent.go:192
a.lastAt没有用atomic.LoadInt64来读取
希望作者能尽快支持KCP协议
MongoDB
方便给一个交流群吗
Do you have a social account? i want to discuss with you
Unity是否有pomelo WebSocket Demo 呢。在pomeloclient上找不到相关的使用
18:25:05.703 DEBUG [node#gate-1] test-cherry/cherry.go:120 [uid = 0] session create. [nodeId = gate-1, sid = 8e53813d-35e5-4385-ab96-d4f4c8ec84d3, address = 127.0.0.1]
18:25:05.705 DEBUG [node#gate-1] command/handshake.go:52 [uid = 0] request handshake. [data = map[code:200 routes:map[] sys:map[heartbeat:60]]]
18:25:05.705 DEBUG [node#gate-1] command/handshake_ack.go:22 [uid = 0] request handshakeACK.
18:25:05.705 DEBUG [node#gate-1] handler/component.go:232 [uid = 0] [local handler] [route = gate.userHandler.login], [group-index = 0]
18:25:05.705 WARN [node#gate-1] handler/handler_group.go:120 recover in executor. goroutine 26 [running]:
runtime/debug.Stack()
D:/Software/Dev/go/src/runtime/debug/stack.go:24 +0x65
github.com/cherry-game/cherry/net/handler.(*HandlerGroup).invokeExecutor.func1()
E:/go_workspace/test-cherry/net/handler/handler_group.go:120 +0x53
panic({0x13bff40, 0xc000380040})
D:/Software/Dev/go/src/runtime/panic.go:1038 +0x215
reflect.Value.call({0x13eb300, 0xc0000932b0, 0x1d476080a28}, {0x14e03c5, 0x4}, {0xc00039a000, 0x3, 0x0})
D:/Software/Dev/go/src/reflect/value.go:411 +0x19ff
reflect.Value.Call({0x13eb300, 0xc0000932b0, 0xc0002dbbc0}, {0xc00039a000, 0x3, 0x3})
D:/Software/Dev/go/src/reflect/value.go:339 +0xc5
github.com/cherry-game/cherry/net/handler.(*ExecutorLocal).Invoke(0xc000450310)
E:/go_workspace/test-cherry/net/handler/executor_local.go:71 +0x954
github.com/cherry-game/cherry/net/handler.(*HandlerGroup).invokeExecutor(0x0, {0x15d97f8, 0xc000450310})
E:/go_workspace/test-cherry/net/handler/handler_group.go:125 +0x70
github.com/cherry-game/cherry/net/handler.(*HandlerGroup).run.func1(0xc000092060)
E:/go_workspace/test-cherry/net/handler/handler_group.go:109 +0x4d
created by github.com/cherry-game/cherry/net/handler.(*HandlerGroup).run
E:/go_workspace/test-cherry/net/handler/handler_group.go:104 +0x1bb
18:25:05.706 WARN [node#gate-1] handler/handler_group.go:121 executor fail [gate.userHandler.login]
比如一个俄罗斯方块这样的小游戏demo
Broadcast 方法目前调用需要开发者自行序列化,但这是不对的,应该在方法内部实现序列化,否则开发者如果用的是protobuffer,结果不知道这个问题,直接使用json.Marshal方法序列化,会导致发送给客户端的数据,客户端无法反序列化
https://github.com/YMoonRiver/Pomelo_UnityWebSocket-2.7.0
修改了一版unity websocket pomelo, 请作者修改收录到仓库。
旧代码:
if app.NodeMode() == Cluster {
cluster := ccluster.New()
app.SetCluster(cluster)
app.Register(cluster)
discovery := cdiscovery.New()
app.SetDiscovery(discovery)
app.Register(discovery)
}
新代码:
if app.NodeMode() == Cluster {
discovery := cdiscovery.New()
app.SetDiscovery(discovery)
app.Register(discovery)
cluster := ccluster.New()
app.SetCluster(cluster)
app.Register(cluster)
}
pitaya之前看过,有点臃肿,nanoserver又略显简陋,cherry实现的就比较合适,会长期关注,谢谢作者的付出。
报错日志如下:
18:19:01.519 bot ERROR actor/actor_timer.go:142 concurrent write to websocket connection
github.com/cherry-game/cherry/net/actor.(*actorTimer).updateTimer.func2
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor_timer.go:142
github.com/cherry-game/cherry/extend/utils.catchError
D:/Workspace/go-game/cherry_server_dev/cherry/extend/utils/utils.go:19
runtime.gopanic
C:/Program Files/Go/src/runtime/panic.go:914
github.com/gorilla/websocket.(*messageWriter).flushFrame
D:/Workspace/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:617
github.com/gorilla/websocket.(*messageWriter).Close
D:/Workspace/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:731
github.com/gorilla/websocket.(*Conn).beginMessage
D:/Workspace/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:480
github.com/gorilla/websocket.(*Conn).NextWriter
D:/Workspace/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:520
github.com/gorilla/websocket.(*Conn).WriteMessage
D:/Workspace/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:773
github.com/cherry-game/cherry/net/connector.(*WSConn).Write
D:/Workspace/go-game/cherry_server_dev/cherry/net/connector/ws_connector.go:141
github.com/cherry-game/cherry/net/parser/pomelo/client.(*Client).Send
D:/Workspace/go-game/cherry_server_dev/cherry/net/parser/pomelo/client/client.go:379
github.com/cherry-game/cherry/net/parser/pomelo/client.(*Client).Request
D:/Workspace/go-game/cherry_server_dev/cherry/net/parser/pomelo/client/client.go:138
main.(*bot).doubleBet
D:/Workspace/go-game/cherry_server_dev/bot/double.go:88
main.(*bot).subscribeDouble.func1.2
D:/Workspace/go-game/cherry_server_dev/bot/double.go:36
github.com/cherry-game/cherry/net/actor.(*actorTimer).updateTimer.func1
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor_timer.go:140
github.com/cherry-game/cherry/extend/utils.Try.func1
D:/Workspace/go-game/cherry_server_dev/cherry/extend/utils/utils.go:11
github.com/cherry-game/cherry/extend/utils.Try
D:/Workspace/go-game/cherry_server_dev/cherry/extend/utils/utils.go:13
github.com/cherry-game/cherry/net/actor.(*actorTimer).updateTimer
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor_timer.go:139
reflect.Value.call
C:/Program Files/Go/src/reflect/value.go:596
reflect.Value.Call
C:/Program Files/Go/src/reflect/value.go:380
github.com/cherry-game/cherry/net/actor.InvokeRemoteFunc.func3
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/invoke.go:63
github.com/cherry-game/cherry/extend/utils.Try.func1
D:/Workspace/go-game/cherry_server_dev/cherry/extend/utils/utils.go:11
github.com/cherry-game/cherry/extend/utils.Try
D:/Workspace/go-game/cherry_server_dev/cherry/extend/utils/utils.go:13
github.com/cherry-game/cherry/net/actor.InvokeRemoteFunc
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/invoke.go:61
github.com/cherry-game/cherry/net/actor.(*Actor).invokeFunc
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor.go:224
github.com/cherry-game/cherry/net/actor.(*Actor).processRemote
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor.go:158
github.com/cherry-game/cherry/net/actor.(*Actor).loop
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor.go:83
github.com/cherry-game/cherry/net/actor.(*Actor).run
D:/Workspace/go-game/cherry_server_dev/cherry/net/actor/actor.go:61
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.