Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
ef8d2262
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ef8d2262
编写于
12月 01, 2017
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
使用protobuf序列化可能是空byte[], 修复benchmark的问题,1000个连接,每秒约4W包
上级
5458ee77
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
15 deletion
+28
-15
Server/App/Program.cs
Server/App/Program.cs
+1
-1
Server/Model/Component/BenchmarkComponent.cs
Server/Model/Component/BenchmarkComponent.cs
+3
-4
Server/Model/Component/Config/ClientConfig.cs
Server/Model/Component/Config/ClientConfig.cs
+11
-1
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs
+4
-0
Unity/Assets/Scripts/Entity/Session.cs
Unity/Assets/Scripts/Entity/Session.cs
+9
-9
未找到文件。
Server/App/Program.cs
浏览文件 @
ef8d2262
...
...
@@ -105,7 +105,7 @@ namespace App
break
;
case
AppType
.
Benchmark
:
Game
.
Scene
.
AddComponent
<
NetOuterComponent
>();
Game
.
Scene
.
AddComponent
<
BenchmarkComponent
,
string
>(
clientConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
BenchmarkComponent
,
IPEndPoint
>(
clientConfig
.
IPEndPoint
);
break
;
default
:
throw
new
Exception
(
$"命令行参数没有设置正确的AppType:
{
startConfig
.
AppType
}
"
);
...
...
Server/Model/Component/BenchmarkComponent.cs
浏览文件 @
ef8d2262
...
...
@@ -24,7 +24,7 @@ namespace Model
try
{
NetOuterComponent
networkComponent
=
Game
.
Scene
.
GetComponent
<
NetOuterComponent
>();
for
(
int
i
=
0
;
i
<
100
;
i
++)
for
(
int
i
=
0
;
i
<
100
0
;
i
++)
{
await
Game
.
Scene
.
GetComponent
<
TimerComponent
>().
WaitAsync
(
1000
);
this
.
TestAsync
(
networkComponent
,
ipEndPoint
,
i
);
...
...
@@ -43,10 +43,9 @@ namespace Model
using
(
Session
session
=
networkComponent
.
Create
(
ipEndPoint
))
{
int
i
=
0
;
while
(
i
<
100000000
)
while
(
i
<
100000000
0
)
{
++
i
;
await
Game
.
Scene
.
GetComponent
<
TimerComponent
>().
WaitAsync
(
10
);
await
this
.
Send
(
session
,
j
);
}
}
...
...
@@ -68,7 +67,7 @@ namespace Model
await
session
.
Call
<
R2C_Ping
>(
new
C2R_Ping
());
++
this
.
k
;
if
(
this
.
k
%
10000
!=
0
)
if
(
this
.
k
%
10000
0
!=
0
)
{
return
;
}
...
...
Server/Model/Component/Config/ClientConfig.cs
浏览文件 @
ef8d2262
using
MongoDB.Bson.Serialization.Attributes
;
using
System.Net
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Model
{
...
...
@@ -16,5 +17,14 @@ namespace Model
return
$"
{
this
.
Host
}
:
{
this
.
Port
}
"
;
}
}
[
BsonIgnore
]
public
IPEndPoint
IPEndPoint
{
get
{
return
NetworkHelper
.
ToIPEndPoint
(
this
.
Host
,
this
.
Port
);
}
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs
浏览文件 @
ef8d2262
...
...
@@ -13,6 +13,7 @@ namespace Model
[
ProtoInclude
((
int
)
Opcode
.
C2R_Login
,
typeof
(
C2R_Login
))]
[
ProtoInclude
((
int
)
Opcode
.
C2G_LoginGate
,
typeof
(
C2G_LoginGate
))]
[
ProtoInclude
((
int
)
Opcode
.
C2G_EnterMap
,
typeof
(
C2G_EnterMap
))]
[
ProtoInclude
((
int
)
Opcode
.
C2R_Ping
,
typeof
(
C2R_Ping
))]
public
abstract
partial
class
ARequest
:
AMessage
{
}
...
...
@@ -21,6 +22,7 @@ namespace Model
[
ProtoInclude
((
int
)
Opcode
.
R2C_Login
,
typeof
(
R2C_Login
))]
[
ProtoInclude
((
int
)
Opcode
.
G2C_LoginGate
,
typeof
(
G2C_LoginGate
))]
[
ProtoInclude
((
int
)
Opcode
.
G2C_EnterMap
,
typeof
(
G2C_EnterMap
))]
[
ProtoInclude
((
int
)
Opcode
.
R2C_Ping
,
typeof
(
R2C_Ping
))]
public
abstract
partial
class
AResponse
:
AMessage
{
}
...
...
@@ -198,11 +200,13 @@ namespace Model
{
}
[
ProtoContract
]
[
Message
(
Opcode
.
C2R_Ping
)]
public
class
C2R_Ping
:
ARequest
{
}
[
ProtoContract
]
[
Message
(
Opcode
.
R2C_Ping
)]
public
class
R2C_Ping
:
AResponse
{
...
...
Unity/Assets/Scripts/Entity/Session.cs
浏览文件 @
ef8d2262
...
...
@@ -62,9 +62,9 @@ namespace Model
continue
;
}
if
(
messageBytes
.
Length
<
3
)
if
(
messageBytes
.
Length
<
2
)
{
Log
.
Error
(
$"message error length <
3
, ip:
{
this
.
RemoteAddress
}
"
);
Log
.
Error
(
$"message error length <
2
, ip:
{
this
.
RemoteAddress
}
"
);
this
.
network
.
Remove
(
this
.
Id
);
return
;
}
...
...
@@ -131,7 +131,7 @@ namespace Model
{
request
.
RpcId
=
++
RpcId
;
this
.
requestCallback
[
RpcId
]
=
(
message
)
=>
this
.
requestCallback
[
request
.
RpcId
]
=
(
message
)
=>
{
try
{
...
...
@@ -155,7 +155,7 @@ namespace Model
request
.
RpcId
=
++
RpcId
;
var
tcs
=
new
TaskCompletionSource
<
AResponse
>();
this
.
requestCallback
[
RpcId
]
=
(
message
)
=>
this
.
requestCallback
[
request
.
RpcId
]
=
(
message
)
=>
{
try
{
...
...
@@ -187,7 +187,7 @@ namespace Model
var
tcs
=
new
TaskCompletionSource
<
AResponse
>();
this
.
requestCallback
[
RpcId
]
=
(
message
)
=>
this
.
requestCallback
[
request
.
RpcId
]
=
(
message
)
=>
{
try
{
...
...
@@ -206,7 +206,7 @@ namespace Model
}
};
cancellationToken
.
Register
(()
=>
{
this
.
requestCallback
.
Remove
(
RpcId
);
});
cancellationToken
.
Register
(()
=>
{
this
.
requestCallback
.
Remove
(
request
.
RpcId
);
});
this
.
SendMessage
(
request
);
...
...
@@ -221,7 +221,7 @@ namespace Model
request
.
RpcId
=
++
RpcId
;
var
tcs
=
new
TaskCompletionSource
<
Response
>();
this
.
requestCallback
[
RpcId
]
=
(
message
)
=>
this
.
requestCallback
[
request
.
RpcId
]
=
(
message
)
=>
{
try
{
...
...
@@ -255,7 +255,7 @@ namespace Model
var
tcs
=
new
TaskCompletionSource
<
Response
>();
this
.
requestCallback
[
RpcId
]
=
(
message
)
=>
this
.
requestCallback
[
request
.
RpcId
]
=
(
message
)
=>
{
try
{
...
...
@@ -274,7 +274,7 @@ namespace Model
}
};
cancellationToken
.
Register
(()
=>
{
this
.
requestCallback
.
Remove
(
RpcId
);
});
cancellationToken
.
Register
(()
=>
{
this
.
requestCallback
.
Remove
(
request
.
RpcId
);
});
this
.
SendMessage
(
request
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录