Skip to content

Commit 50ae0dc

Browse files
author
Seabiscuit
committed
ThrowHelper & LoggingExtensions
1 parent 65a61c0 commit 50ae0dc

File tree

187 files changed

+5027
-1377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+5027
-1377
lines changed

DotNetty.sln

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpServer", "examples\Http
9898
EndProject
9999
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetty.Transport.Libuv.Tests", "test\DotNetty.Transport.Libuv.Tests\DotNetty.Transport.Libuv.Tests.csproj", "{5938CE7C-61CD-4C70-82B8-B236AC881A14}"
100100
EndProject
101-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSockets.Client", "examples\WebSockets.Client\WebSockets.Client.csproj", "{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}"
101+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSockets.Server", "examples\WebSockets.Server\WebSockets.Server.csproj", "{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}"
102102
EndProject
103-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSockets.Server", "examples\WebSockets.Server\WebSockets.Server.csproj", "{AA8F9D2A-1055-4018-84A3-D623172787CD}"
103+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSockets.Client", "examples\WebSockets.Client\WebSockets.Client.csproj", "{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}"
104104
EndProject
105105
Global
106106
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -710,38 +710,38 @@ Global
710710
{5938CE7C-61CD-4C70-82B8-B236AC881A14}.Release|x64.Build.0 = Release|Any CPU
711711
{5938CE7C-61CD-4C70-82B8-B236AC881A14}.Release|x86.ActiveCfg = Release|Any CPU
712712
{5938CE7C-61CD-4C70-82B8-B236AC881A14}.Release|x86.Build.0 = Release|Any CPU
713-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
714-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|Any CPU.Build.0 = Debug|Any CPU
715-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|ARM.ActiveCfg = Debug|Any CPU
716-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|ARM.Build.0 = Debug|Any CPU
717-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|x64.ActiveCfg = Debug|Any CPU
718-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|x64.Build.0 = Debug|Any CPU
719-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|x86.ActiveCfg = Debug|Any CPU
720-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Debug|x86.Build.0 = Debug|Any CPU
721-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|Any CPU.ActiveCfg = Release|Any CPU
722-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|Any CPU.Build.0 = Release|Any CPU
723-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|ARM.ActiveCfg = Release|Any CPU
724-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|ARM.Build.0 = Release|Any CPU
725-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|x64.ActiveCfg = Release|Any CPU
726-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|x64.Build.0 = Release|Any CPU
727-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|x86.ActiveCfg = Release|Any CPU
728-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649}.Release|x86.Build.0 = Release|Any CPU
729-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
730-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
731-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|ARM.ActiveCfg = Debug|Any CPU
732-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|ARM.Build.0 = Debug|Any CPU
733-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|x64.ActiveCfg = Debug|Any CPU
734-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|x64.Build.0 = Debug|Any CPU
735-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|x86.ActiveCfg = Debug|Any CPU
736-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Debug|x86.Build.0 = Debug|Any CPU
737-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
738-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|Any CPU.Build.0 = Release|Any CPU
739-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|ARM.ActiveCfg = Release|Any CPU
740-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|ARM.Build.0 = Release|Any CPU
741-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|x64.ActiveCfg = Release|Any CPU
742-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|x64.Build.0 = Release|Any CPU
743-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|x86.ActiveCfg = Release|Any CPU
744-
{AA8F9D2A-1055-4018-84A3-D623172787CD}.Release|x86.Build.0 = Release|Any CPU
713+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
714+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|Any CPU.Build.0 = Debug|Any CPU
715+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|ARM.ActiveCfg = Debug|Any CPU
716+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|ARM.Build.0 = Debug|Any CPU
717+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|x64.ActiveCfg = Debug|Any CPU
718+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|x64.Build.0 = Debug|Any CPU
719+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|x86.ActiveCfg = Debug|Any CPU
720+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Debug|x86.Build.0 = Debug|Any CPU
721+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|Any CPU.ActiveCfg = Release|Any CPU
722+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|Any CPU.Build.0 = Release|Any CPU
723+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|ARM.ActiveCfg = Release|Any CPU
724+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|ARM.Build.0 = Release|Any CPU
725+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|x64.ActiveCfg = Release|Any CPU
726+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|x64.Build.0 = Release|Any CPU
727+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|x86.ActiveCfg = Release|Any CPU
728+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385}.Release|x86.Build.0 = Release|Any CPU
729+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
730+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
731+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|ARM.ActiveCfg = Debug|Any CPU
732+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|ARM.Build.0 = Debug|Any CPU
733+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|x64.ActiveCfg = Debug|Any CPU
734+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|x64.Build.0 = Debug|Any CPU
735+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|x86.ActiveCfg = Debug|Any CPU
736+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Debug|x86.Build.0 = Debug|Any CPU
737+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
738+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|Any CPU.Build.0 = Release|Any CPU
739+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|ARM.ActiveCfg = Release|Any CPU
740+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|ARM.Build.0 = Release|Any CPU
741+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|x64.ActiveCfg = Release|Any CPU
742+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|x64.Build.0 = Release|Any CPU
743+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|x86.ActiveCfg = Release|Any CPU
744+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9}.Release|x86.Build.0 = Release|Any CPU
745745
EndGlobalSection
746746
GlobalSection(SolutionProperties) = preSolution
747747
HideSolutionNode = FALSE
@@ -786,8 +786,8 @@ Global
786786
{26A8779A-44B1-46D4-A43E-FA2616EBFD02} = {01F3CC7E-F996-411E-AFD6-72673A826549}
787787
{BDDF75B4-4BAB-49DE-97A3-CA191C523636} = {3511E2D1-F581-420E-8DC4-8F0386947621}
788788
{5938CE7C-61CD-4C70-82B8-B236AC881A14} = {01F3CC7E-F996-411E-AFD6-72673A826549}
789-
{91F3EB7C-FB5C-4ADB-A3F2-D95A3165E649} = {3511E2D1-F581-420E-8DC4-8F0386947621}
790-
{AA8F9D2A-1055-4018-84A3-D623172787CD} = {3511E2D1-F581-420E-8DC4-8F0386947621}
789+
{F3AA2B9E-0AA7-4F13-B5F5-5BFF34FF8385} = {3511E2D1-F581-420E-8DC4-8F0386947621}
790+
{DA148037-5219-49C2-B76F-9B0F2BFC5FA9} = {3511E2D1-F581-420E-8DC4-8F0386947621}
791791
EndGlobalSection
792792
GlobalSection(ExtensibilityGlobals) = postSolution
793793
SolutionGuid = {A659CEFB-DDB3-49BE-AEDD-FF2F1B3297DB}

src/DotNetty.Buffers/AbstractUnpooledSlicedByteBuffer.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ protected AbstractUnpooledSlicedByteBuffer(IByteBuffer buffer, int index, int le
2121
{
2222
CheckSliceOutOfBounds(index, length, buffer);
2323

24-
if (buffer is AbstractUnpooledSlicedByteBuffer byteBuffer)
24+
switch (buffer)
2525
{
26-
this.buffer = byteBuffer.buffer;
27-
this.adjustment = byteBuffer.adjustment + index;
28-
}
29-
else if (buffer is UnpooledDuplicatedByteBuffer)
30-
{
31-
this.buffer = buffer.Unwrap();
32-
this.adjustment = index;
33-
}
34-
else
35-
{
36-
this.buffer = buffer;
37-
this.adjustment = index;
26+
case AbstractUnpooledSlicedByteBuffer byteBuffer:
27+
this.buffer = byteBuffer.buffer;
28+
this.adjustment = byteBuffer.adjustment + index;
29+
break;
30+
31+
case UnpooledDuplicatedByteBuffer _:
32+
this.buffer = buffer.Unwrap();
33+
this.adjustment = index;
34+
break;
35+
36+
default:
37+
this.buffer = buffer;
38+
this.adjustment = index;
39+
break;
3840
}
3941

4042
this.SetWriterIndex0(length);
@@ -329,7 +331,7 @@ internal static void CheckSliceOutOfBounds(int index, int length, IByteBuffer bu
329331
{
330332
if (MathUtil.IsOutOfBounds(index, length, buffer.Capacity))
331333
{
332-
throw new IndexOutOfRangeException($"{buffer}.Slice({index}, {length})");
334+
ThrowHelper.ThrowIndexOutOfRangeException_CheckSliceOutOfBounds(index, length, buffer);
333335
}
334336
}
335337
}

src/DotNetty.Buffers/ByteBufferUtil.cs

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -317,25 +317,25 @@ public static IByteBuffer WriteUtf8(IByteBufferAllocator alloc, ICharSequence se
317317

318318
public static int ReserveAndWriteUtf8(IByteBuffer buf, ICharSequence seq, int reserveBytes)
319319
{
320-
for (;;)
320+
while(true)
321321
{
322-
if (buf is AbstractByteBuffer byteBuf)
322+
switch (buf)
323323
{
324-
byteBuf.EnsureWritable0(reserveBytes);
325-
int written = WriteUtf8(byteBuf, byteBuf.WriterIndex, seq, seq.Count);
326-
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
327-
return written;
328-
}
329-
else if (buf is WrappedByteBuffer)
330-
{
331-
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
332-
buf = buf.Unwrap();
333-
}
334-
else
335-
{
336-
byte[] bytes = Encoding.UTF8.GetBytes(seq.ToString());
337-
buf.WriteBytes(bytes);
338-
return bytes.Length;
324+
case AbstractByteBuffer byteBuf:
325+
byteBuf.EnsureWritable0(reserveBytes);
326+
int written = WriteUtf8(byteBuf, byteBuf.WriterIndex, seq, seq.Count);
327+
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
328+
return written;
329+
330+
case WrappedByteBuffer _:
331+
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
332+
buf = buf.Unwrap();
333+
break;
334+
335+
default:
336+
byte[] bytes = Encoding.UTF8.GetBytes(seq.ToString());
337+
buf.WriteBytes(bytes);
338+
return bytes.Length;
339339
}
340340
}
341341
}
@@ -422,25 +422,25 @@ public static IByteBuffer WriteUtf8(IByteBufferAllocator alloc, string value)
422422
/// <returns> This method returns the actual number of bytes written.</returns>
423423
public static int ReserveAndWriteUtf8(IByteBuffer buf, string value, int reserveBytes)
424424
{
425-
for (;;)
425+
while(true)
426426
{
427-
if (buf is AbstractByteBuffer byteBuf)
427+
switch (buf)
428428
{
429-
byteBuf.EnsureWritable0(reserveBytes);
430-
int written = WriteUtf8(byteBuf, byteBuf.WriterIndex, value, value.Length);
431-
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
432-
return written;
433-
}
434-
else if (buf is WrappedByteBuffer)
435-
{
436-
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
437-
buf = buf.Unwrap();
438-
}
439-
else
440-
{
441-
byte[] bytes = Encoding.UTF8.GetBytes(value);
442-
buf.WriteBytes(bytes);
443-
return bytes.Length;
429+
case AbstractByteBuffer byteBuf:
430+
byteBuf.EnsureWritable0(reserveBytes);
431+
int written = WriteUtf8(byteBuf, byteBuf.WriterIndex, value, value.Length);
432+
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
433+
return written;
434+
435+
case WrappedByteBuffer _:
436+
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
437+
buf = buf.Unwrap();
438+
break;
439+
440+
default:
441+
byte[] bytes = Encoding.UTF8.GetBytes(value);
442+
buf.WriteBytes(bytes);
443+
return bytes.Length;
444444
}
445445
}
446446
}
@@ -595,25 +595,25 @@ public static int WriteAscii(IByteBuffer buf, ICharSequence seq)
595595
}
596596
else
597597
{
598-
for (;;)
598+
while(true)
599599
{
600-
if (buf is AbstractByteBuffer byteBuf)
600+
switch (buf)
601601
{
602-
byteBuf.EnsureWritable0(len);
603-
int written = WriteAscii(byteBuf, byteBuf.WriterIndex, seq, len);
604-
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
605-
return written;
606-
}
607-
else if (buf is WrappedByteBuffer)
608-
{
609-
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
610-
buf = buf.Unwrap();
611-
}
612-
else
613-
{
614-
byte[] bytes = Encoding.ASCII.GetBytes(seq.ToString());
615-
buf.WriteBytes(bytes);
616-
return bytes.Length;
602+
case AbstractByteBuffer byteBuf:
603+
byteBuf.EnsureWritable0(len);
604+
int written = WriteAscii(byteBuf, byteBuf.WriterIndex, seq, len);
605+
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
606+
return written;
607+
608+
case WrappedByteBuffer _:
609+
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
610+
buf = buf.Unwrap();
611+
break;
612+
613+
default:
614+
byte[] bytes = Encoding.ASCII.GetBytes(seq.ToString());
615+
buf.WriteBytes(bytes);
616+
return bytes.Length;
617617
}
618618
}
619619
}
@@ -644,25 +644,25 @@ public static int WriteAscii(IByteBuffer buf, string value)
644644
{
645645
// ASCII uses 1 byte per char
646646
int len = value.Length;
647-
for (;;)
647+
while(true)
648648
{
649-
if (buf is AbstractByteBuffer byteBuf)
650-
{
651-
byteBuf.EnsureWritable0(len);
652-
int written = WriteAscii(byteBuf, byteBuf.WriterIndex, value, len);
653-
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
654-
return written;
655-
}
656-
else if (buf is WrappedByteBuffer)
649+
switch (buf)
657650
{
658-
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
659-
buf = buf.Unwrap();
660-
}
661-
else
662-
{
663-
byte[] bytes = Encoding.ASCII.GetBytes(value);
664-
buf.WriteBytes(bytes);
665-
return bytes.Length;
651+
case AbstractByteBuffer byteBuf:
652+
byteBuf.EnsureWritable0(len);
653+
int written = WriteAscii(byteBuf, byteBuf.WriterIndex, value, len);
654+
byteBuf.SetWriterIndex(byteBuf.WriterIndex + written);
655+
return written;
656+
657+
case WrappedByteBuffer _:
658+
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
659+
buf = buf.Unwrap();
660+
break;
661+
662+
default:
663+
byte[] bytes = Encoding.ASCII.GetBytes(value);
664+
buf.WriteBytes(bytes);
665+
return bytes.Length;
666666
}
667667
}
668668
}
@@ -1037,7 +1037,7 @@ public static bool IsText(IByteBuffer buf, int index, int length, Encoding encod
10371037
int maxIndex = buf.ReaderIndex + buf.ReadableBytes;
10381038
if (index < 0 || length < 0 || index > maxIndex - length)
10391039
{
1040-
throw new IndexOutOfRangeException($"index: {index}length: {length}");
1040+
ThrowHelper.ThrowIndexOutOfRangeException_IsText(index, length);
10411041
}
10421042
if (ReferenceEquals(Encoding.UTF8, encoding))
10431043
{

src/DotNetty.Buffers/CompositeByteBuffer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ public virtual int ToComponentIndex(int offset)
804804
}
805805
}
806806

807-
throw new Exception("should not reach here");
807+
return ThrowHelper.ThrowGetException_ShouldNotReachHere<int>();
808808
}
809809

810810
public virtual int ToByteIndex(int cIndex)
@@ -1304,7 +1304,7 @@ ComponentEntry FindComponent(int offset)
13041304
}
13051305
}
13061306

1307-
throw new Exception("should not reach here");
1307+
return ThrowHelper.ThrowGetException_ShouldNotReachHere<ComponentEntry>();
13081308
}
13091309

13101310
/// <summary>

src/DotNetty.Buffers/EmptyByteBuffer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ IByteBuffer CheckIndex(int index)
506506
{
507507
if (index != 0)
508508
{
509-
throw new IndexOutOfRangeException();
509+
ThrowHelper.ThrowIndexOutOfRangeException();
510510
}
511511
return this;
512512
}
@@ -515,11 +515,11 @@ IByteBuffer CheckIndex(int index, int length)
515515
{
516516
if (length < 0)
517517
{
518-
throw new ArgumentException("length: " + length);
518+
ThrowHelper.ThrowArgumentException_CheckIndex(length);
519519
}
520520
if (index != 0 || length != 0)
521521
{
522-
throw new IndexOutOfRangeException();
522+
ThrowHelper.ThrowIndexOutOfRangeException();
523523
}
524524

525525
return this;
@@ -530,11 +530,11 @@ IByteBuffer CheckLength(int length)
530530
{
531531
if (length < 0)
532532
{
533-
throw new ArgumentException("length: " + length + " (expected: >= 0)");
533+
ThrowHelper.ThrowArgumentException_CheckLength(length);
534534
}
535535
if (length != 0)
536536
{
537-
throw new IndexOutOfRangeException();
537+
ThrowHelper.ThrowIndexOutOfRangeException();
538538
}
539539
return this;
540540
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Runtime.CompilerServices;
6+
using DotNetty.Common.Concurrency;
7+
using DotNetty.Common.Internal.Logging;
8+
9+
namespace DotNetty.Buffers
10+
{
11+
internal static class BuffersLoggingExtensions
12+
{
13+
[MethodImpl(MethodImplOptions.NoInlining)]
14+
public static void FreedThreadLocalBufferFromThread(this IInternalLogger logger, int numFreed, XThread deathWatchThread)
15+
{
16+
logger.Debug("Freed {} thread-local buffer(s) from thread: {}", numFreed, deathWatchThread.Name);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)