Skip to content

Commit ee9d609

Browse files
committed
[增加]1. 增加网络渠道基类注释
1 parent cf1d665 commit ee9d609

File tree

1 file changed

+45
-5
lines changed

1 file changed

+45
-5
lines changed

Runtime/Network/Network/NetworkManager.NetworkChannelBase.cs

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ public sealed partial class NetworkManager
2222
/// </summary>
2323
public abstract class NetworkChannelBase : INetworkChannel, IDisposable
2424
{
25+
/// <summary>
26+
/// 默认心跳间隔
27+
/// </summary>
2528
private const float DefaultHeartBeatInterval = 30f;
29+
30+
/// <summary>
31+
/// 默认心跳丢失断开次数
32+
/// </summary>
2633
private const int DefaultMissHeartBeatCountByClose = 10;
2734

2835
protected readonly GameFrameworkLinkedList<MessageObject> PSendPacketPool;
@@ -44,20 +51,57 @@ public abstract class NetworkChannelBase : INetworkChannel, IDisposable
4451
/// </summary>
4552
protected int MissHeartBeatCountByClose;
4653

54+
/// <summary>
55+
/// 发送消息ID忽略列表
56+
/// </summary>
4757
protected List<int> IgnoreSendIds = new List<int>();
58+
59+
/// <summary>
60+
/// 接收消息ID忽略列表
61+
/// </summary>
4862
protected List<int> IgnoreReceiveIds = new List<int>();
4963

64+
/// <summary>
65+
/// 网络Socket 对象
66+
/// </summary>
5067
protected INetworkSocket PSocket;
68+
5169
protected readonly SendState PSendState;
5270
protected readonly ReceiveState PReceiveState;
5371
protected readonly HeartBeatState PHeartBeatState;
5472
protected readonly RpcState PRpcState;
73+
74+
/// <summary>
75+
/// 是否验证地址
76+
/// </summary>
77+
protected bool IsVerifyAddress = true;
78+
79+
/// <summary>
80+
/// 链接目标地址
81+
/// </summary>
82+
protected IPEndPoint ConnectEndPoint;
83+
84+
/// <summary>
85+
/// 发送数据包的数量
86+
/// </summary>
5587
protected int PSentPacketCount;
88+
89+
/// <summary>
90+
/// 接收数据包数量
91+
/// </summary>
5692
protected int PReceivedPacketCount;
93+
94+
/// <summary>
95+
/// 是否正在连接中
96+
/// </summary>
5797
protected bool PIsConnecting = false;
98+
5899
private bool m_Disposed;
59100
private bool m_PActive;
60101

102+
/// <summary>
103+
/// 网络是否激活
104+
/// </summary>
61105
protected bool PActive
62106
{
63107
get { return m_PActive; }
@@ -113,7 +157,6 @@ public NetworkChannelBase(string name, INetworkChannelHelper networkChannelHelpe
113157
PActive = false;
114158
PIsConnecting = false;
115159
m_Disposed = false;
116-
117160
NetworkChannelConnected = null;
118161
NetworkChannelClosed = null;
119162
NetworkChannelMissHeartBeat = null;
@@ -314,7 +357,7 @@ public virtual void Update(float elapseSeconds, float realElapseSeconds)
314357
}
315358

316359
/// <summary>
317-
///
360+
/// 处理接收到的消息
318361
/// </summary>
319362
private void ProcessReceivedMessage()
320363
{
@@ -541,8 +584,6 @@ public void SetRPCEndHandler(EventHandler<MessageObject> handler)
541584
PRpcState.SetRPCEndHandler(handler);
542585
}
543586

544-
protected bool IsVerifyAddress = true;
545-
protected IPEndPoint ConnectEndPoint;
546587

547588
/// <summary>
548589
/// 连接到远程主机。
@@ -647,7 +688,6 @@ public virtual void Close()
647688
{
648689
PSocket.Close();
649690
PSocket = null;
650-
651691
NetworkChannelClosed?.Invoke(this);
652692
}
653693

0 commit comments

Comments
 (0)