Skip to content

Commit

Permalink
fix ReadJagged() and WriteJagged() not looping through a jagged byte …
Browse files Browse the repository at this point in the history
…array properly.
  • Loading branch information
Ninjastorm380 committed Mar 13, 2022
1 parent 5f61e77 commit e1597ed
Show file tree
Hide file tree
Showing 24 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Maelstrom/Source/Socket/Methods.vb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Public Partial Class Socket
ReDim Output(ReadIsJagged - 1)
ReadJaggedIndexer = 0
ReadJaggedCounter = 0
Do Until ReadJaggedIndexer = ReadIsJagged
Do Until ReadJaggedIndexer > ReadIsJagged - 1
UnpackInt32(ReadPaddedData, ReadJaggedIndexLength, ReadJaggedCounter)
ReadJaggedCounter += 4
Redim Output(ReadJaggedIndexer)(ReadJaggedIndexLength - 1)
Expand Down Expand Up @@ -277,7 +277,7 @@ Public Partial Class Socket
ReDim Output(ReadIsJagged - 1)
ReadJaggedIndexer = 0
ReadJaggedCounter = 0
Do Until ReadJaggedIndexer = ReadIsJagged
Do Until ReadJaggedIndexer > ReadIsJagged - 1
UnpackInt32(ReadPaddedData, ReadJaggedIndexLength, ReadJaggedCounter)
ReadJaggedCounter += 4
Redim Output(ReadJaggedIndexer)(ReadJaggedIndexLength - 1)
Expand All @@ -294,9 +294,9 @@ Public Partial Class Socket
If Manager.Contains(Index) = False Then Throw New ArgumentException("Parameter 'Index' referrs to a non-existent stream!")
If Input Is Nothing Then Throw New ArgumentException("Parameter 'Input' must not be nothing!")
SyncLock WriteLock
WriteDataLength = input.Length*4
WriteDataLength = input.Length * 4
WriteJaggedIndexer = 0
Do Until WriteJaggedIndexer = Input.Length - 1
Do Until WriteJaggedIndexer > Input.Length - 1
WriteDataLength += Input(WriteJaggedIndexer).Length
WriteJaggedIndexer += 1
Loop
Expand All @@ -309,7 +309,7 @@ Public Partial Class Socket

WriteJaggedIndexer = 0
WriteJaggedCounter = 0
Do Until WriteJaggedIndexer = Input.Length - 1
Do Until WriteJaggedIndexer > Input.Length - 1
PackInt32(Input(WriteJaggedIndexer).Length, WritePaddedData, WriteJaggedCounter)
WriteJaggedCounter += 4
Buffer.BlockCopy(Input(WriteJaggedIndexer), 0, WritePaddedData, WriteJaggedCounter,
Expand Down
Binary file modified Maelstrom/bin/Debug/netstandard2.0/Maelstrom.dll
Binary file not shown.
Binary file modified Maelstrom/bin/Debug/netstandard2.0/Maelstrom.pdb
Binary file not shown.
Binary file modified Maelstrom/bin/Release/netstandard2.0/Maelstrom.dll
Binary file not shown.
Binary file modified Maelstrom/obj/Debug/netstandard2.0/Maelstrom.dll
Binary file not shown.
Binary file modified Maelstrom/obj/Debug/netstandard2.0/Maelstrom.pdb
Binary file not shown.
Binary file not shown.
Binary file modified Maelstrom/obj/Release/netstandard2.0/Maelstrom.dll
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions MaelstromTests/TestClient.vb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Imports Maelstrom

Friend Class TestClient : Inherits ClientBase
Dim P(4)() as Byte
Dim P(3)() as Byte

Protected Overrides Sub OnConnectionErrored(Socket As Socket, SError As SocketError)
Console.WriteLine("DEBUG - CLIENT: client connection setup errored: " + SError.ToString())
Expand Down Expand Up @@ -33,7 +33,7 @@ Friend Class TestClient : Inherits ClientBase
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
Next
for x = 0 to 199
for x = 0 to 0
CreateAsyncInstance(Socket,x)
Next

Expand All @@ -50,7 +50,7 @@ Friend Class TestClient : Inherits ClientBase
Private Sub CreateAsyncInstance(Socket as Socket, Index as Int32)
Dim AsyncThread as new Threading.Thread(
Sub()
Dim Governor as new Governor(1000)
Dim Governor as new Governor(1)
Socket.CreateStream(Index)
Socket.WriteJagged(Index, P)
Do While Socket.Connected = True
Expand Down
6 changes: 3 additions & 3 deletions MaelstromTests/TestServer.vb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Imports Maelstrom

Friend Class TestServer : Inherits ServerBase
Dim P(4)() as Byte
Dim P(3)() as Byte
Protected Overrides Sub OnConnectionErrored(Socket As Socket, SError As SocketError)
Console.WriteLine("DEBUG - SERVER: client connection setup errored: " + SError.ToString())
End Sub
Expand All @@ -12,7 +12,7 @@ Friend Class TestServer : Inherits ServerBase

Protected Overrides Sub OnConnectionMain(Socket As Socket)
Dim Governor as new Governor(10)
for x = 0 to 199
for x = 0 to 0
CreateAsyncInstance(Socket,x)
Next
Do While Socket.Connected = True And Online = True
Expand Down Expand Up @@ -54,7 +54,7 @@ Friend Class TestServer : Inherits ServerBase
Private Sub CreateAsyncInstance(Socket as Socket, Index as Int32)
Dim AsyncThread as new Threading.Thread(
Sub()
Dim Governor as new Governor(1000)
Dim Governor as new Governor(1)
Socket.CreateStream(Index)
Socket.WriteJagged(Index, P)
Do While Socket.Connected = True And Online = True
Expand Down
Binary file modified MaelstromTests/bin/Debug/netcoreapp3.1/Maelstrom.dll
Binary file not shown.
Binary file modified MaelstromTests/bin/Debug/netcoreapp3.1/Maelstrom.pdb
Binary file not shown.
Binary file modified MaelstromTests/bin/Debug/netcoreapp3.1/MaelstromTests.dll
Binary file not shown.
Binary file modified MaelstromTests/bin/Debug/netcoreapp3.1/MaelstromTests.pdb
Binary file not shown.
Binary file modified MaelstromTests/bin/Release/netcoreapp3.1/Maelstrom.dll
Binary file not shown.
Binary file modified MaelstromTests/bin/Release/netcoreapp3.1/MaelstromTests.dll
Binary file not shown.
Binary file modified MaelstromTests/bin/Release/netcoreapp3.1/MaelstromTests.pdb
Binary file not shown.
Binary file modified MaelstromTests/obj/Debug/netcoreapp3.1/MaelstromTests.dll
Binary file not shown.
Binary file modified MaelstromTests/obj/Debug/netcoreapp3.1/MaelstromTests.pdb
Binary file not shown.
Binary file not shown.
Binary file modified MaelstromTests/obj/Release/netcoreapp3.1/MaelstromTests.dll
Binary file not shown.
Binary file modified MaelstromTests/obj/Release/netcoreapp3.1/MaelstromTests.pdb
Binary file not shown.
Binary file not shown.

0 comments on commit e1597ed

Please sign in to comment.