From 921c6aab9e372e9f7bc4217c81e5a0f0e83e8338 Mon Sep 17 00:00:00 2001 From: mgortman Date: Thu, 6 Aug 2015 18:11:42 -0700 Subject: [PATCH] ChannelHandlerAdapter: virtual + impl deregister Correctly placed "virtual", implemented default DeregisterAsync behavior. Minor tweaks to ReSharper settings. --- DotNetty.sln.DotSettings | 12 ++++++------ .../Channels/ChannelHandlerAdapter.cs | 15 ++++++++------- .../Channels/IChannelHandler.cs | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/DotNetty.sln.DotSettings b/DotNetty.sln.DotSettings index 0ccd421..8c44962 100644 --- a/DotNetty.sln.DotSettings +++ b/DotNetty.sln.DotSettings @@ -16,10 +16,11 @@ HINT DO_NOT_SHOW HINT - DO_NOT_SHOW - DO_NOT_SHOW + WARNING + WARNING + WARNING HINT - <?xml version="1.0" encoding="utf-16"?><Profile name="Simple"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSMakeFieldReadonly>True</CSMakeFieldReadonly><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></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></Profile> Simple Simple All @@ -29,11 +30,9 @@ 1 False False - DO_NOT_CHANGE ALWAYS_ADD ALWAYS_ADD ALWAYS_ADD - DO_NOT_CHANGE ALWAYS_ADD 1 1 @@ -87,4 +86,5 @@ Licensed under the MIT license. See LICENSE file in the project root for full li <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> True True - True \ No newline at end of file + True + CSharp50 \ No newline at end of file diff --git a/src/DotNetty.Transport/Channels/ChannelHandlerAdapter.cs b/src/DotNetty.Transport/Channels/ChannelHandlerAdapter.cs index 9956113..e9c0fba 100644 --- a/src/DotNetty.Transport/Channels/ChannelHandlerAdapter.cs +++ b/src/DotNetty.Transport/Channels/ChannelHandlerAdapter.cs @@ -48,7 +48,7 @@ namespace DotNetty.Transport.Channels } [Skip] - public void ChannelWritabilityChanged(IChannelHandlerContext context) + public virtual void ChannelWritabilityChanged(IChannelHandlerContext context) { context.FireChannelWritabilityChanged(); } @@ -76,25 +76,25 @@ namespace DotNetty.Transport.Channels } [Skip] - public void Flush(IChannelHandlerContext context) + public virtual void Flush(IChannelHandlerContext context) { context.Flush(); } [Skip] - public Task BindAsync(IChannelHandlerContext context, EndPoint localAddress) + public virtual Task BindAsync(IChannelHandlerContext context, EndPoint localAddress) { return context.BindAsync(localAddress); } [Skip] - public Task ConnectAsync(IChannelHandlerContext context, EndPoint remoteAddress, EndPoint localAddress) + public virtual Task ConnectAsync(IChannelHandlerContext context, EndPoint remoteAddress, EndPoint localAddress) { return context.ConnectAsync(remoteAddress, localAddress); } [Skip] - public Task DisconnectAsync(IChannelHandlerContext context) + public virtual Task DisconnectAsync(IChannelHandlerContext context) { return context.DisconnectAsync(); } @@ -111,9 +111,10 @@ namespace DotNetty.Transport.Channels context.FireExceptionCaught(exception); } - public Task DeregisterAsync(IChannelHandlerContext context) + [Skip] + public virtual Task DeregisterAsync(IChannelHandlerContext context) { - throw new NotImplementedException(); + return context.DeregisterAsync(); } [Skip] diff --git a/src/DotNetty.Transport/Channels/IChannelHandler.cs b/src/DotNetty.Transport/Channels/IChannelHandler.cs index 8918682..b86d5cf 100644 --- a/src/DotNetty.Transport/Channels/IChannelHandler.cs +++ b/src/DotNetty.Transport/Channels/IChannelHandler.cs @@ -89,6 +89,7 @@ namespace DotNetty.Transport.Channels [PipelinePropagation(PropagationDirections.Inbound)] void ExceptionCaught(IChannelHandlerContext context, Exception exception); + [PipelinePropagation(PropagationDirections.Outbound)] Task DeregisterAsync(IChannelHandlerContext context); [PipelinePropagation(PropagationDirections.Outbound)]