Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with DotNetty #54

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/DotNetty.Codecs.Http2/AbstractHttp2StreamChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,18 @@ internal void StreamClosed()

public IChannelConfiguration Configuration => _config;

[Obsolete("Please use IsOpen instead.")]
public bool Open => IsOpen;

public bool IsOpen
{
[MethodImpl(InlineMethod.AggressiveOptimization)]
get => !_closePromise.IsCompleted;
}

[Obsolete("Please use IsActive instead.")]
public bool Active => IsActive;

public bool IsActive => IsOpen;

public bool IsWritable => 0u >= (uint)Volatile.Read(ref v_unwritable);
Expand All @@ -144,6 +150,9 @@ public bool IsOpen

public IChannel Parent => ParentContext.Channel;

[Obsolete("Please use IsRegistered instead.")]
public bool Registered => IsRegistered;

public bool IsRegistered => InternalRegistered;

public EndPoint LocalAddress => Parent.LocalAddress;
Expand Down
9 changes: 9 additions & 0 deletions src/DotNetty.Transport/Channels/AbstractChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ public IEventLoop EventLoop
}
}

[Obsolete("Please use IsOpen instead.")]
public bool Open => IsOpen;

public abstract bool IsOpen { get; }

[Obsolete("Please use IsActive instead.")]
public bool Active => IsActive;

public abstract bool IsActive { get; }

public abstract ChannelMetadata Metadata { get; }
Expand Down Expand Up @@ -215,6 +221,9 @@ protected EndPoint CacheRemoteAddress()
}
}

[Obsolete("Please use IsRegistered instead.")]
public bool Registered => IsRegistered;

public bool IsRegistered => SharedConstants.False < (uint)Volatile.Read(ref v_registered);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private bool InvokeHandler
}
}

[Obsolete("=>IsRemoved")]
[Obsolete("Please use IsRemoved instead.")]
public bool Removed => IsRemoved;

public bool IsRemoved => 0u >= (uint)(Volatile.Read(ref v_handlerState) - HandlerState.RemoveComplete);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public DelegatingChannelHandlerContext(IChannelHandlerContext ctx, IChannelHandl

public IChannelHandler Handler => _ctx.Handler;

[Obsolete("Please use IsRemoved instead.")]
public bool Removed => IsRemoved;

public bool IsRemoved => _removed || _ctx.IsRemoved;

public IChannelHandlerContext FireChannelRegistered()
Expand Down
14 changes: 14 additions & 0 deletions src/DotNetty.Transport/Channels/DefaultChannelConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public virtual IMessageSizeEstimator MessageSizeEstimator
}
}

[Obsolete("Please use IsAutoRead instead.")]
public bool AutoRead
{
get => IsAutoRead;
set => IsAutoRead = value;
}

public bool IsAutoRead
{
get { return SharedConstants.False < (uint)Volatile.Read(ref _autoRead); }
Expand All @@ -264,6 +271,13 @@ protected virtual void AutoReadCleared()
{
}

[Obsolete("Please use IsAutoClose instead.")]
public bool AutoClose
{
get => IsAutoClose;
set => IsAutoClose = value;
}

public bool IsAutoClose
{
get { return SharedConstants.False < (uint)Volatile.Read(ref _autoClose); }
Expand Down
9 changes: 9 additions & 0 deletions src/DotNetty.Transport/Channels/IChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ public interface IChannel : IAttributeMap, IComparable<IChannel>, IEquatable<ICh
/// </summary>
IChannel Parent { get; }

[Obsolete("Please use IsOpen instead.")]
bool Open { get; }

[Obsolete("Please use IsActive instead.")]
bool Active { get; }

[Obsolete("Please use IsRegistered instead.")]
bool Registered { get; }

/// <summary>
/// Returns <c>true</c> if the <see cref="IChannel"/> is open and may get active later.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions src/DotNetty.Transport/Channels/IChannelConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,20 @@ public interface IChannelConfiguration
/// <summary>Gets or sets the <see cref="IRecvByteBufAllocator"/> which is used for the channel to allocate receive buffers.</summary>
IRecvByteBufAllocator RecvByteBufAllocator { get; set; }

/// <summary>Gets or sets if <see cref="IChannelHandlerContext.Read()"/> will be invoked automatically so that a user application doesn't
/// need to call it at all. The default value is <c>true</c>.</summary>
[Obsolete("Please use IsAutoRead instead.")]
bool AutoRead { get; set; }

/// <summary>Gets or sets if <see cref="IChannelHandlerContext.Read()"/> will be invoked automatically so that a user application doesn't
/// need to call it at all. The default value is <c>true</c>.</summary>
bool IsAutoRead { get; set; }

/// <summary>Gets or sets whether the <see cref="IChannel"/> should be closed automatically and immediately on write failure.
/// The default is <c>true</c>.</summary>
[Obsolete("Please use IsAutoClose instead.")]
bool AutoClose { get; set; }

/// <summary>Gets or sets whether the <see cref="IChannel"/> should be closed automatically and immediately on write failure.
/// The default is <c>true</c>.</summary>
bool IsAutoClose { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions src/DotNetty.Transport/Channels/IChannelHandlerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ public interface IChannelHandlerContext : IAttributeMap
/// </summary>
IChannelHandler Handler { get; }

/// <summary>
/// Return <c>true</c> if the <see cref="IChannelHandler"/> which belongs to this context was removed
/// from the <see cref="IChannelPipeline"/>. Note that this method is only meant to be called from with in the
/// <see cref="IEventLoop"/>.
/// </summary>
[Obsolete("Please use IsRemoved instead.")]
bool Removed { get; }

/// <summary>
/// Return <c>true</c> if the <see cref="IChannelHandler"/> which belongs to this context was removed
/// from the <see cref="IChannelPipeline"/>. Note that this method is only meant to be called from with in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public WriteInboundChannelHandlerContext(EmbeddedChannel channel)

public IChannelHandler Handler => this;

public bool Removed => false;
public bool IsRemoved => false;

public IChannelPipeline Pipeline => _channel.Pipeline;
Expand Down