Skip to content

Commit

Permalink
调整handler后, 所有测试通过
Browse files Browse the repository at this point in the history
  • Loading branch information
davyxu committed Feb 14, 2017
1 parent 1565251 commit 1452e72
Show file tree
Hide file tree
Showing 41 changed files with 1,031 additions and 952 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/proto/protoc-gen-go.exe
/proto/protoc.exe
/protoc-gen-msg/protoc-gen-msg.exe
example/close/*.exe
example/echo/*.exe
example/rpc/*.exe
36 changes: 27 additions & 9 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# V3版本
## 版本特性

- 全面使用Handler处理封包接收,发送, 解析, 日志, RPC等结构

- 支持自由定义封包处理管线

## 变化及修改

- 大幅降低底层内存分配, GC降低后, benchmark提升1w QPS

- socket.RegisterMessage参数统一为*SessionEvent

- 去除RPC包装, 解包封包的重复代码. 无需callid支持, 封包变小


# V2版本

## 版本特性

- 实现单线程逻辑时, 全局只有1个EventQueue. 而不是一个Peer一个Queue

- EventDispatcher处理回调

- 处理DB, Timer等不依赖Dispatcher(Peer)逻辑时, 在Post时, Dispatcher可以指定nil, 通过data的函数得到异步返回

- 去掉MongoDB支持


## 变化及修改

- 去掉V1中的EventPipe
Expand All @@ -16,12 +43,3 @@

- 例子/测试用例使用sample文件夹命名

## V2版本特性

- 实现单线程逻辑时, 全局只有1个EventQueue. 而不是一个Peer一个Queue

- EventDispatcher处理回调

- 处理DB, Timer等不依赖Dispatcher(Peer)逻辑时, 在Post时, Dispatcher可以指定nil, 通过data的函数得到异步返回

- 去掉MongoDB支持
14 changes: 7 additions & 7 deletions benchmark/io/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/davyxu/cellnet"
"github.com/davyxu/cellnet/benchmark"
"github.com/davyxu/cellnet/example"
"github.com/davyxu/cellnet/proto/gamedef"
"github.com/davyxu/cellnet/sample"
"github.com/davyxu/cellnet/socket"
"github.com/davyxu/golog"
)
Expand Down Expand Up @@ -36,14 +36,14 @@ func server() {

evd := socket.NewAcceptor(queue).Start(benchmarkAddress)

socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(ev *cellnet.SessionEvent) {

if qpsm.Acc() > benchmarkSeconds {
signal.Done(1)
log.Infof("Average QPS: %d", qpsm.Average())
}

ses.Send(&gamedef.TestEchoACK{})
ev.Ses.Send(&gamedef.TestEchoACK{})

})

Expand All @@ -57,15 +57,15 @@ func client() {

evd := socket.NewConnector(queue).Start(benchmarkAddress)

socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(ev *cellnet.SessionEvent) {

ses.Send(&gamedef.TestEchoACK{})
ev.Ses.Send(&gamedef.TestEchoACK{})

})

socket.RegisterMessage(evd, "gamedef.SessionConnected", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.SessionConnected", func(ev *cellnet.SessionEvent) {

ses.Send(&gamedef.TestEchoACK{})
ev.Ses.Send(&gamedef.TestEchoACK{})

})

Expand Down
Binary file added cellnet.test.exe
Binary file not shown.
204 changes: 0 additions & 204 deletions dispatcher.go

This file was deleted.

Loading

0 comments on commit 1452e72

Please sign in to comment.