/// <summary> /// 关闭 /// </summary> public async void Close() { await BoundChannel.CloseAsync(); await BossGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)); await WorkerGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)); }
/// <summary> /// The StopAsync /// </summary> /// <param name="cancellationToken">The <see cref="CancellationToken"/></param> /// <returns>The <see cref="Task"/></returns> public async Task StopAsync() { // Stop called without start if (BoundChannel == null) { return; } try { // Signal cancellation to the executing method await BoundChannel.CloseAsync(); } catch (Exception) { } }