Skip to content

Commit e4c94b4

Browse files
committed
some cleanup
1 parent c8447de commit e4c94b4

File tree

4 files changed

+21
-36
lines changed

4 files changed

+21
-36
lines changed

LiteNetLib/NetDebug.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33

44
namespace LiteNetLib
55
{
6+
public class InvalidPacketException : ArgumentException
7+
{
8+
public InvalidPacketException(string message) : base(message)
9+
{
10+
}
11+
}
12+
13+
public class TooBigPacketException : InvalidPacketException
14+
{
15+
public TooBigPacketException(string message) : base(message)
16+
{
17+
}
18+
}
19+
620
public enum NetLogLevel
721
{
822
Warning,

LiteNetLib/NetExceptions.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

LiteNetLib/NetManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private struct IncomingData
169169
private volatile int _connectedPeersCount;
170170
private readonly List<NetPeer> _connectedPeerListCache;
171171
private NetPeer[] _peersArray;
172-
internal readonly PacketLayerBase _extraPacketLayer;
172+
private readonly PacketLayerBase _extraPacketLayer;
173173
private int _lastPeerId;
174174
private readonly Queue<int> _peerIds;
175175
private byte _channelsCount = 1;
@@ -342,6 +342,11 @@ public NetPeer GetPeerById(int id)
342342
/// </summary>
343343
public int ConnectedPeersCount { get { return _connectedPeersCount; } }
344344

345+
public int ExtraPacketSizeForLayer
346+
{
347+
get { return _extraPacketLayer != null ? _extraPacketLayer.ExtraPacketSizeForLayer : 0; }
348+
}
349+
345350
private bool TryGetPeer(IPEndPoint endPoint, out NetPeer peer)
346351
{
347352
_peersLock.EnterReadLock();

LiteNetLib/NetPeer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ internal NetPeer(NetManager netManager, IPEndPoint remoteEndPoint, int id)
222222

223223
private void SetMtu(int mtuIdx)
224224
{
225-
int extraLayerSpace = NetManager._extraPacketLayer != null ? NetManager._extraPacketLayer.ExtraPacketSizeForLayer : 0;
226-
_mtu = NetConstants.PossibleMtu[mtuIdx] - extraLayerSpace;
225+
_mtu = NetConstants.PossibleMtu[mtuIdx] - NetManager.ExtraPacketSizeForLayer;
227226
}
228227

229228
/// <summary>

0 commit comments

Comments
 (0)