Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
4f37269f
E
et
项目概览
老鱼er
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
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,发现更多精彩内容 >>
提交
4f37269f
编写于
12月 30, 2014
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enet mtu 改成512,启用crc校验
上级
8ce25cc1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
12 addition
and
18 deletion
+12
-18
CSharp/Platform/ENet/enet.h
CSharp/Platform/ENet/enet.h
+1
-1
CSharp/Platform/ENet/host.cc
CSharp/Platform/ENet/host.cc
+1
-0
CSharp/Platform/UNet/EService.cs
CSharp/Platform/UNet/EService.cs
+1
-6
CSharp/Platform/UNet/NativeMethods.cs
CSharp/Platform/UNet/NativeMethods.cs
+0
-3
CSharp/Platform/UNet/USocket.cs
CSharp/Platform/UNet/USocket.cs
+6
-5
CSharp/Platform/UNetExe/Program.cs
CSharp/Platform/UNetExe/Program.cs
+1
-1
CSharp/Platform/UNetTest/UNetTest.csproj
CSharp/Platform/UNetTest/UNetTest.csproj
+1
-1
CSharp/Platform/UNetTest/UServiceTest.cs
CSharp/Platform/UNetTest/UServiceTest.cs
+1
-1
未找到文件。
CSharp/Platform/ENet/enet.h
浏览文件 @
4f37269f
...
...
@@ -208,7 +208,7 @@ enum
ENET_HOST_RECEIVE_BUFFER_SIZE
=
256
*
1024
,
ENET_HOST_SEND_BUFFER_SIZE
=
256
*
1024
,
ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL
=
1000
,
ENET_HOST_DEFAULT_MTU
=
1400
,
ENET_HOST_DEFAULT_MTU
=
512
,
ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE
=
32
*
1024
*
1024
,
ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA
=
32
*
1024
*
1024
,
...
...
CSharp/Platform/ENet/host.cc
浏览文件 @
4f37269f
...
...
@@ -102,6 +102,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
host
->
duplicatePeers
=
ENET_PROTOCOL_MAXIMUM_PEER_ID
;
host
->
maximumPacketSize
=
ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE
;
host
->
maximumWaitingData
=
ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA
;
host
->
checksum
=
enet_crc32
;
host
->
compressor
.
context
=
NULL
;
host
->
compressor
.
compress
=
NULL
;
...
...
CSharp/Platform/UNet/EService.cs
浏览文件 @
4f37269f
...
...
@@ -89,11 +89,6 @@ namespace UNet
}
}
public
void
EnableCrc
()
{
NativeMethods
.
EnetEnableCrc
(
this
.
host
);
}
private
EEvent
GetEvent
()
{
var
enetEv
=
new
ENetEvent
();
...
...
@@ -102,7 +97,7 @@ namespace UNet
{
return
null
;
}
var
e
=
new
EEvent
(
enetEv
);
EEvent
e
=
new
EEvent
(
enetEv
);
return
e
;
}
...
...
CSharp/Platform/UNet/NativeMethods.cs
浏览文件 @
4f37269f
...
...
@@ -44,9 +44,6 @@ namespace UNet
EntryPoint
=
"enet_initialize_with_callbacks"
)]
internal
static
extern
int
EnetInitializeWithCallbacks
(
uint
version
,
ref
ENetCallbacks
inits
);
[
DllImport
(
LIB
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"enet_enable_crc"
)]
internal
static
extern
void
EnetEnableCrc
(
IntPtr
host
);
[
DllImport
(
LIB
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"enet_host_create"
)]
internal
static
extern
IntPtr
EnetHostCreate
(
ref
ENetAddress
address
,
uint
peerLimit
,
uint
channelLimit
,
uint
incomingBandwidth
,
...
...
CSharp/Platform/UNet/USocket.cs
浏览文件 @
4f37269f
...
...
@@ -52,7 +52,8 @@ namespace UNet
{
return
new
ENetPeer
();
}
return
(
ENetPeer
)
Marshal
.
PtrToStructure
(
this
.
peerPtr
,
typeof
(
ENetPeer
));
ENetPeer
peer
=
(
ENetPeer
)
Marshal
.
PtrToStructure
(
this
.
peerPtr
,
typeof
(
ENetPeer
));
return
peer
;
}
set
{
...
...
@@ -175,11 +176,11 @@ namespace UNet
// 如果有缓存的包,从缓存中取
if
(
this
.
recvBuffer
.
Count
>
0
)
{
var
bytes
=
this
.
recvBuffer
.
First
.
Value
;
byte
[]
bytes
=
this
.
recvBuffer
.
First
.
Value
;
this
.
recvBuffer
.
RemoveFirst
();
tcs
.
TrySetResult
(
bytes
);
}
// 没有缓存封包,设置回调等待
// 没有缓存封包,设置回调等待
else
{
this
.
Received
=
eEvent
=>
...
...
@@ -189,9 +190,9 @@ namespace UNet
tcs
.
TrySetException
(
new
EException
(
"socket disconnected in receive"
));
}
using
(
var
packet
=
new
EPacket
(
eEvent
.
PacketPtr
))
using
(
EPacket
packet
=
new
EPacket
(
eEvent
.
PacketPtr
))
{
var
bytes
=
packet
.
Bytes
;
byte
[]
bytes
=
packet
.
Bytes
;
tcs
.
TrySetResult
(
bytes
);
}
};
...
...
CSharp/Platform/UNetExe/Program.cs
浏览文件 @
4f37269f
...
...
@@ -6,7 +6,7 @@ namespace ENetExe
{
private
static
void
Main
(
string
[]
args
)
{
var
test
=
new
U
NetClientServer
Test
();
var
test
=
new
U
Service
Test
();
test
.
ClientSendToServer
();
}
}
...
...
CSharp/Platform/UNetTest/UNetTest.csproj
浏览文件 @
4f37269f
...
...
@@ -54,7 +54,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile
Include=
"U
NetClientServer
Test.cs"
/>
<Compile
Include=
"U
Service
Test.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\Common\Common.csproj"
>
...
...
CSharp/Platform/UNetTest/U
NetClientServer
Test.cs
→
CSharp/Platform/UNetTest/U
Service
Test.cs
浏览文件 @
4f37269f
...
...
@@ -9,7 +9,7 @@ using Network;
namespace
UNetTest
{
[
TestClass
]
public
class
U
NetClientServer
Test
public
class
U
Service
Test
{
private
readonly
Barrier
barrier
=
new
Barrier
(
3
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录