Skip to content

Commit 018ca6e

Browse files
author
Nick Schulz
committed
Fixes needed for PPP
1 parent 2f2e281 commit 018ca6e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Hazel/MessageReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public int Position
3131
}
3232

3333
private int _position;
34-
private int readHead;
34+
public int readHead;
3535

3636
public static MessageReader GetSized(int minSize)
3737
{

Hazel/MessageWriter.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public byte[] ToByteArray(bool includeHeader)
6363

6464
///
6565
/// <param name="sendOption">The option specifying how the message should be sent.</param>
66-
public static MessageWriter Get(SendOption sendOption = SendOption.None)
66+
public static MessageWriter Get(SendOption sendOption = SendOption.None, bool clearArray = true)
6767
{
6868
var output = WriterPool.GetObject();
69-
output.Clear(sendOption);
69+
output.Clear(sendOption, clearArray);
7070

7171
return output;
7272
}
@@ -113,9 +113,10 @@ public void ClearMessageStarts()
113113
this.messageStarts.Clear();
114114
}
115115

116-
public void Clear(SendOption sendOption)
116+
public void Clear(SendOption sendOption, bool clearArray = true)
117117
{
118-
ClearMessageStarts();
118+
if (clearArray) { Array.Clear(this.Buffer, 0, this.Buffer.Length); }
119+
this.messageStarts.Clear();
119120
this.SendOption = sendOption;
120121
this.Buffer[0] = (byte)sendOption;
121122
switch (sendOption)

0 commit comments

Comments
 (0)