How to solve the program freezing when calling bootstrap.BindAsync(localAddress).Result in Unity?
- Dominant language
- C#
- Stars
- 4.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
How to solve the program freezing when calling bootstrap.BindAsync(localAddress).Result in Unity?
Code:
private void init () {
_executorPool = executorPool;
_executorPool.CreateMessageExecutor();
_eventLoopGroup = eventLoopGroup;
_scheduleThread = new EventLoopScheduleThread();
bootstrap = new Bootstrap();
bootstrap.Group(_eventLoopGroup);
bootstrap.ChannelFactory(() => new SocketDatagramChannel(AddressFamily.InterNetwork));
bootstrap.Handler(new ActionChannelInitializer(channel =>
{
var pipeline = channel.Pipeline;
pipeline.AddLast(new ClientChannelHandler(_channelManager,channelConfig));
}));
}
private static IChannel bindLocal(Bootstrap bootstrap,EndPoint localAddress = null)
{
if (localAddress == null)
{
localAddress = new IPEndPoint(IPAddress.Any, 0);
}
// ------> program freezing <------
return bootstrap.BindAsync(localAddress).Result;
}
Contributor guide
Assessment
This issue has not been assessed yet.