withSIX.Play.Core.Games.Legacy.ServerQuery.ServerQueryState.Cancel C# (CSharp) Method

Cancel() public method

public Cancel ( ) : void
return void
        public virtual void Cancel() {
            ReceivedPackets = null;
            TryClose();
            if (Server != null)
                Server.Ping = Common.MagicPingValue;
            Canceled = true;
        }

Usage Example

        async Task FetchAsync()
        {
            try {
                await ProcessAllPackets().ConfigureAwait(false);

                _state.ProcessParser(_parser);
                if (_state.Success)
                {
                    _state.Server.UpdateInfoFromResult(_state.Result);
                }
            } catch (TimeoutException e) {
                /*
                 #if DEBUG
                 * this.Logger().FormattedDebugException(e, "Swallowed");
                 #endif
                 */
                _state.Exception = e;
                _state.Cancel();
            } catch (ObjectDisposedException e) {
                /*
                 #if DEBUG
                 * this.Logger().FormattedDebugException(e, "Swallowed");
                 #endif
                 */
                _state.Exception = e;
                _state.Cancel();
            } catch (Exception e) {
                _state.Exception = e;
                _state.Cancel();
                throw;
            } finally {
                _state.StopSW();
            }
        }
All Usage Examples Of withSIX.Play.Core.Games.Legacy.ServerQuery.ServerQueryState::Cancel