diff --git a/DotNetty.sln.DotSettings b/DotNetty.sln.DotSettings
index 877c3e8..9272488 100644
--- a/DotNetty.sln.DotSettings
+++ b/DotNetty.sln.DotSettings
@@ -20,7 +20,7 @@
WARNING
WARNING
HINT
- <?xml version="1.0" encoding="utf-16"?><Profile name="Simple"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>IMPLICIT_EXCEPT_PRIMITIVE_TYPES</ForeachVariableStyle></CSUseVar><CSUpdateFileHeader>True</CSUpdateFileHeader><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>ReplaceAll</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><CSShortenReferences>True</CSShortenReferences><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSharpFormatDocComments>True</CSharpFormatDocComments></Profile>
+ <?xml version="1.0" encoding="utf-16"?><Profile name="Simple"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>IMPLICIT_EXCEPT_PRIMITIVE_TYPES</ForeachVariableStyle></CSUseVar><CSUpdateFileHeader>True</CSUpdateFileHeader><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>ReplaceAll</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><CSShortenReferences>True</CSShortenReferences><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSharpFormatDocComments>True</CSharpFormatDocComments><CSArrangeTypeModifiers>True</CSArrangeTypeModifiers><CSArrangeTypeMemberModifiers>True</CSArrangeTypeMemberModifiers><CSSortModifiers>True</CSSortModifiers></Profile>
Simple
Simple
Implicit
diff --git a/examples/Echo.Client/Echo.Client.csproj b/examples/Echo.Client/Echo.Client.csproj
index b9f25f2..82d49bb 100644
--- a/examples/Echo.Client/Echo.Client.csproj
+++ b/examples/Echo.Client/Echo.Client.csproj
@@ -32,6 +32,14 @@
4
+
+ ..\..\packages\EnterpriseLibrary.SemanticLogging.2.0.1406.1\lib\net45\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll
+ True
+
+
+ ..\..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll
+ True
+
@@ -48,6 +56,7 @@
+
diff --git a/examples/Echo.Client/EchoClientHandler.cs b/examples/Echo.Client/EchoClientHandler.cs
index e4b2905..00850eb 100644
--- a/examples/Echo.Client/EchoClientHandler.cs
+++ b/examples/Echo.Client/EchoClientHandler.cs
@@ -33,7 +33,7 @@ namespace Echo.Client
if (byteBuffer != null)
{
this.buffer.Initialize();
- byteBuffer.ReadBytes(this.buffer, 0, byteBuffer.ReadableBytes);
+ byteBuffer.Duplicate().ReadBytes(this.buffer, 0, byteBuffer.ReadableBytes);
string msg = Encoding.UTF8.GetString(this.buffer);
Console.WriteLine("Received from server: " + msg);
}
diff --git a/examples/Echo.Client/Program.cs b/examples/Echo.Client/Program.cs
index 33cde48..b361d22 100644
--- a/examples/Echo.Client/Program.cs
+++ b/examples/Echo.Client/Program.cs
@@ -4,19 +4,27 @@
namespace Echo.Client
{
using System;
+ using System.Diagnostics.Tracing;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
+ using DotNetty.Common.Internal.Logging;
using DotNetty.Handlers.Tls;
using DotNetty.Transport.Bootstrapping;
using DotNetty.Transport.Channels;
using DotNetty.Transport.Channels.Sockets;
-
+ using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
+
class Program
{
static async Task RunClient()
{
+ var eventListener = new ObservableEventListener();
+ eventListener.LogToConsole();
+ eventListener.EnableEvents(DefaultEventSource.Log, EventLevel.Verbose);
+
var group = new MultithreadEventLoopGroup();
+
try
{
var bootstrap = new Bootstrap();
@@ -47,6 +55,7 @@ namespace Echo.Client
finally
{
group.ShutdownGracefullyAsync().Wait(1000);
+ eventListener.Dispose();
}
}
diff --git a/examples/Echo.Client/packages.config b/examples/Echo.Client/packages.config
new file mode 100644
index 0000000..7f9aea4
--- /dev/null
+++ b/examples/Echo.Client/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Echo.Server/Echo.Server.csproj b/examples/Echo.Server/Echo.Server.csproj
index 50ecbbe..55ec67e 100644
--- a/examples/Echo.Server/Echo.Server.csproj
+++ b/examples/Echo.Server/Echo.Server.csproj
@@ -32,6 +32,14 @@
4
+
+ ..\..\packages\EnterpriseLibrary.SemanticLogging.2.0.1406.1\lib\net45\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll
+ True
+
+
+ ..\..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll
+ True
+
@@ -48,6 +56,7 @@
+
diff --git a/examples/Echo.Server/Program.cs b/examples/Echo.Server/Program.cs
index 871b907..8a57b42 100644
--- a/examples/Echo.Server/Program.cs
+++ b/examples/Echo.Server/Program.cs
@@ -4,17 +4,24 @@
namespace Echo.Server
{
using System;
+ using System.Diagnostics.Tracing;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
+ using DotNetty.Common.Internal.Logging;
using DotNetty.Handlers.Tls;
using DotNetty.Transport.Bootstrapping;
using DotNetty.Transport.Channels;
using DotNetty.Transport.Channels.Sockets;
-
+ using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
+
class Program
{
static async Task RunServer()
{
+ var eventListener = new ObservableEventListener();
+ eventListener.LogToConsole();
+ eventListener.EnableEvents(DefaultEventSource.Log, EventLevel.Verbose);
+
var bossGroup = new MultithreadEventLoopGroup(1);
var workerGroup = new MultithreadEventLoopGroup();
try
@@ -45,6 +52,7 @@ namespace Echo.Server
finally
{
Task.WaitAll(bossGroup.ShutdownGracefullyAsync(), workerGroup.ShutdownGracefullyAsync());
+ eventListener.Dispose();
}
}
diff --git a/examples/Echo.Server/packages.config b/examples/Echo.Server/packages.config
new file mode 100644
index 0000000..7f9aea4
--- /dev/null
+++ b/examples/Echo.Server/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/DotNetty.Buffers/PooledByteBufferAllocator.cs b/src/DotNetty.Buffers/PooledByteBufferAllocator.cs
index c90fb8e..b298beb 100644
--- a/src/DotNetty.Buffers/PooledByteBufferAllocator.cs
+++ b/src/DotNetty.Buffers/PooledByteBufferAllocator.cs
@@ -3,7 +3,6 @@
namespace DotNetty.Buffers
{
- using System.Diagnostics;
using System.Diagnostics.Contracts;
using DotNetty.Common;
@@ -22,12 +21,6 @@ namespace DotNetty.Buffers
false); // todo: prepare
}
- [Conditional("TRACE")]
- public void LogUsage()
- {
- this.pool.LogUsage("pooled buffers available");
- }
-
public int MaxPooledBufSize { get; private set; }
protected override IByteBuffer NewBuffer(int initialCapacity, int maxCapacity)
diff --git a/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj b/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj
index a347022..a81abbd 100644
--- a/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj
+++ b/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj
@@ -39,7 +39,6 @@
Properties\SharedAssemblyInfo.cs
-
diff --git a/src/DotNetty.Codecs.Mqtt/MqttDecoder.cs b/src/DotNetty.Codecs.Mqtt/MqttDecoder.cs
index e86909a..324f36c 100644
--- a/src/DotNetty.Codecs.Mqtt/MqttDecoder.cs
+++ b/src/DotNetty.Codecs.Mqtt/MqttDecoder.cs
@@ -46,10 +46,6 @@ namespace DotNetty.Codecs.Mqtt
output.Add(packet);
this.Checkpoint();
- if (MqttEventSource.Log.IsVerboseEnabled)
- {
- MqttEventSource.Log.Verbose("Decoded packet.", packet.ToString());
- }
break;
case ParseState.Failed:
// read out data until connection is closed
@@ -59,16 +55,11 @@ namespace DotNetty.Codecs.Mqtt
throw new ArgumentOutOfRangeException();
}
}
- catch (DecoderException ex)
+ catch (DecoderException)
{
input.SkipBytes(input.ReadableBytes);
this.Checkpoint(ParseState.Failed);
- if (MqttEventSource.Log.IsErrorEnabled)
- {
- MqttEventSource.Log.Error("Exception while decoding.", ex);
- }
-
- this.CloseAsync(context);
+ throw;
}
}
diff --git a/src/DotNetty.Codecs.Mqtt/MqttEncoder.cs b/src/DotNetty.Codecs.Mqtt/MqttEncoder.cs
index 01a67db..973e93c 100644
--- a/src/DotNetty.Codecs.Mqtt/MqttEncoder.cs
+++ b/src/DotNetty.Codecs.Mqtt/MqttEncoder.cs
@@ -21,11 +21,6 @@ namespace DotNetty.Codecs.Mqtt
protected override void Encode(IChannelHandlerContext context, Packet message, List