protected override void PostStop() { try { RemoteConnection.Shutdown(_connection); RemoteConnection.ReleaseAll().Wait(_settings.ConnectTimeout); } catch (Exception ex) { _log.Error(ex, "Error while terminating RemoteConnection."); } }
public override void ChannelInactive(IChannelHandlerContext context) { if (!_loggedDisconnect) //added this to help mute log messages { _loggedDisconnect = true; _log.Debug("disconnected from {0}", context.Channel.RemoteAddress); } _fsm.Tell(PoisonPill.Instance); // run outside of the Helios / DotNetty threadpool Task.Factory.StartNew(() => { RemoteConnection.Shutdown(context.Channel); RemoteConnection.ReleaseAll(); // yep, let it run asynchronously. }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); context.FireChannelInactive(); }