Azure / Azure/DotNetty

channel.CloseCompletion.ContinueWith not working (unity3d)

Open
#477 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Currently in the process of porting some working code from Netty to DotNetty to use in my Unity game. Unity version I'm using is 2018.3.8f1 with following configuration:

Scripting Runtime Version = .NET 4.x Equivalent
Scripting Backend = Mono
API compatibility level = .NET 4.x

Things seem to be working for the most part but I found a weird issue.

Here you can see the original code for Netty and my attempt at porting to DotNetty:
```
ChannelFuture connectionFuture = bootstrap.connect("127.0.0.1", 12345);
connectionFuture.addListener(new GenericFutureListener()
{
@Override
public void operationComplete(ChannelFuture future) throws Exception
{
if (future.isSuccess())
{
future.channel().closeFuture().addListener(new GenericFutureListener()
{
@Override
public void operationComplete(ChannelFuture future) throws Exception
{
System.out.println("Channel closed");
}
});
}
else
{
System.out.println("Connection failed");
}
}
});
```

```
Task connectionTask = bootstrap.ConnectAsync("127.0.0.1", 12345);
connectionTask.ContinueWith(delegate(Task task)
{
if (task.IsFaulted || task.IsCanceled)
{
Debug.Log("Connection failed");
}
else
{
task.Result.CloseCompletion.ContinueWith(delegate(Task task1)
{
Debug.Log("Channel closed");
});
}
});
```

In both instances when the channel closes after a successful connection I expect to see printed "Channel closed". The Netty code works just fine, but with DotNetty this never prints. This leads me to believe the CloseCompletion is never being run. Seems like a bug to me.

As a workaround, I was able to attach my channel close behaviour to a ChannelHandlerAdapter which overrides ChannelInactive instead, so this issue isn't blocking me from working on my game, but I figured I should report it anyway.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.