Skip to content
Permalink
Browse files

Fixed bad variable name.

  • Loading branch information...
NTDLS committed Sep 20, 2018
1 parent 2f3eb08 commit 08cee9b2658618a8e3b1f700c6e7308da205736a
Showing with 13 additions and 13 deletions.
  1. +1 −1 NetProxy.Hub/Common/Constants.cs
  2. +6 −6 NetProxy.Hub/Common/Packetizer.cs
  3. +6 −6 NetProxy.Service/Routing/Packetizer.cs
@@ -4,7 +4,7 @@ public static class Constants
{
public const int PayloadDelimiter = 122455788;
public const int DefaultBufferSize = 1024;
public const int PayloadHeadeerSize = 10;
public const int PayloadHeaderSize = 10;
public const int DefaultMinMsgSize = 0;
public const int DefaultMaxMsgSize = 1024 * 1024;
}
@@ -16,7 +16,7 @@ public static byte[] AssembleMessagePacket(Packet packet)
byte[] payloadBody = Serialization.ObjectToByteArray(packet);

byte[] payloadBytes = Zip(payloadBody);
int grossPacketSize = payloadBytes.Length + Constants.PayloadHeadeerSize;
int grossPacketSize = payloadBytes.Length + Constants.PayloadHeaderSize;

byte[] packetBytes = new byte[grossPacketSize];

@@ -25,7 +25,7 @@ public static byte[] AssembleMessagePacket(Packet packet)
Buffer.BlockCopy(BitConverter.GetBytes(Constants.PayloadDelimiter), 0, packetBytes, 0, 4);
Buffer.BlockCopy(BitConverter.GetBytes(grossPacketSize), 0, packetBytes, 4, 4);
Buffer.BlockCopy(BitConverter.GetBytes(payloadCrc), 0, packetBytes, 8, 2);
Buffer.BlockCopy(payloadBytes, 0, packetBytes, Constants.PayloadHeadeerSize, payloadBytes.Length);
Buffer.BlockCopy(payloadBytes, 0, packetBytes, Constants.PayloadHeaderSize, payloadBytes.Length);

return packetBytes;
}
@@ -79,7 +79,7 @@ public static void DissasemblePacketData(SocketState state, ProcessPayloadCallba

state.PayloadBuilderLength = state.PayloadBuilderLength + state.BytesReceived;

while (state.PayloadBuilderLength > Constants.PayloadHeadeerSize) //[PayloadSize] and [CRC16]
while (state.PayloadBuilderLength > Constants.PayloadHeaderSize) //[PayloadSize] and [CRC16]
{
Byte[] payloadDelimiterBytes = new Byte[4];
Byte[] payloadSizeBytes = new Byte[4];
@@ -114,7 +114,7 @@ public static void DissasemblePacketData(SocketState state, ProcessPayloadCallba
break;
}

UInt16 actualCrc16 = Crc16.ComputeChecksum(state.PayloadBuilder, Constants.PayloadHeadeerSize, grossPayloadSize - Constants.PayloadHeadeerSize);
UInt16 actualCrc16 = Crc16.ComputeChecksum(state.PayloadBuilder, Constants.PayloadHeaderSize, grossPayloadSize - Constants.PayloadHeaderSize);

if (actualCrc16 != expectedCrc16)
{
@@ -123,10 +123,10 @@ public static void DissasemblePacketData(SocketState state, ProcessPayloadCallba
continue;
}

int netPayloadSize = grossPayloadSize - Constants.PayloadHeadeerSize;
int netPayloadSize = grossPayloadSize - Constants.PayloadHeaderSize;
byte[] payloadBytes = new byte[netPayloadSize];

Buffer.BlockCopy(state.PayloadBuilder, Constants.PayloadHeadeerSize, payloadBytes, 0, netPayloadSize);
Buffer.BlockCopy(state.PayloadBuilder, Constants.PayloadHeaderSize, payloadBytes, 0, netPayloadSize);

byte[] payloadBody = Unzip(payloadBytes);

@@ -82,7 +82,7 @@ public static byte[] AssembleMessagePacket(PacketEnvelope envelope, bool compres
payloadBody = Encrypt(encryptPacketKey, keySalt, payloadBody);
}

int grossPacketSize = payloadBody.Length + Constants.PayloadHeadeerSize;
int grossPacketSize = payloadBody.Length + Constants.PayloadHeaderSize;

byte[] packetBytes = new byte[grossPacketSize];

@@ -91,7 +91,7 @@ public static byte[] AssembleMessagePacket(PacketEnvelope envelope, bool compres
Buffer.BlockCopy(BitConverter.GetBytes(Constants.PayloadDelimiter), 0, packetBytes, 0, 4);
Buffer.BlockCopy(BitConverter.GetBytes(grossPacketSize), 0, packetBytes, 4, 4);
Buffer.BlockCopy(BitConverter.GetBytes(payloadCrc), 0, packetBytes, 8, 2);
Buffer.BlockCopy(payloadBody, 0, packetBytes, Constants.PayloadHeadeerSize, payloadBody.Length);
Buffer.BlockCopy(payloadBody, 0, packetBytes, Constants.PayloadHeaderSize, payloadBody.Length);

return packetBytes;
}
@@ -147,7 +147,7 @@ public static List<PacketEnvelope> DissasemblePacketData(Router router, SocketSt

state.PayloadBuilderLength = state.PayloadBuilderLength + state.BytesReceived;

while (state.PayloadBuilderLength > Constants.PayloadHeadeerSize) //[PayloadSize] and [CRC16]
while (state.PayloadBuilderLength > Constants.PayloadHeaderSize) //[PayloadSize] and [CRC16]
{
Byte[] payloadDelimiterBytes = new Byte[4];
Byte[] payloadSizeBytes = new Byte[4];
@@ -185,7 +185,7 @@ public static List<PacketEnvelope> DissasemblePacketData(Router router, SocketSt
break;
}

UInt16 actualCrc16 = Crc16.ComputeChecksum(state.PayloadBuilder, Constants.PayloadHeadeerSize, grossPayloadSize - Constants.PayloadHeadeerSize);
UInt16 actualCrc16 = Crc16.ComputeChecksum(state.PayloadBuilder, Constants.PayloadHeaderSize, grossPayloadSize - Constants.PayloadHeaderSize);

if (actualCrc16 != expectedCrc16)
{
@@ -195,10 +195,10 @@ public static List<PacketEnvelope> DissasemblePacketData(Router router, SocketSt
continue;
}

int netPayloadSize = grossPayloadSize - Constants.PayloadHeadeerSize;
int netPayloadSize = grossPayloadSize - Constants.PayloadHeaderSize;
byte[] payloadBytes = new byte[netPayloadSize];

Buffer.BlockCopy(state.PayloadBuilder, Constants.PayloadHeadeerSize, payloadBytes, 0, netPayloadSize);
Buffer.BlockCopy(state.PayloadBuilder, Constants.PayloadHeaderSize, payloadBytes, 0, netPayloadSize);

if (encrypt)
{

0 comments on commit 08cee9b

Please sign in to comment.
You can’t perform that action at this time.