Skip to content

Commit b504480

Browse files
author
Michael DeRoy
committed
Fix issue where TLS requests would reallocate a buffer when it could reuse it
1 parent 084bac8 commit b504480

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ public void Reset ()
7070
{
7171
Offset = Size = 0;
7272
TotalBytes = 0;
73-
Buffer = new byte[InitialSize];
73+
if (Buffer.Length <= InitialSize)
74+
Array.Clear (Buffer, 0, Buffer.Length);
75+
else
76+
Buffer = new byte[InitialSize];
7477
Complete = false;
7578
}
7679

0 commit comments

Comments
 (0)