Beispiel #1
0
        private void Abort()
        {
            lock (_sync)
            {
                if (_state != ServerState.Start)
                {
                    return;
                }

                _state = ServerState.ShuttingDown;
            }

            try
            {
                try
                {
                    _listener.Stop();
                }
                finally
                {
                    _services.Stop(1006, String.Empty);
                }
            }
            catch { }

            _state = ServerState.Stop;
        }
Beispiel #2
0
        private void abort()
        {
            lock (_sync) {
                if (_state != ServerState.Start)
                {
                    return;
                }

                _state = ServerState.ShuttingDown;
            }

            try {
                _listener.Stop();
            }
            catch (Exception ex) {
                _log.Fatal(ex.Message);
                _log.Debug(ex.ToString());
            }

            try {
                _services.Stop(1006, String.Empty);
            }
            catch (Exception ex) {
                _log.Fatal(ex.Message);
                _log.Debug(ex.ToString());
            }

            _state = ServerState.Stop;
        }
Beispiel #3
0
        private void abort()
        {
            lock (_sync) {
                if (!IsListening)
                {
                    return;
                }

                _state = ServerState.ShuttingDown;
            }

            _listener.Stop();
            _services.Stop(new CloseEventArgs(CloseStatusCode.ServerError), true, false);

            _state = ServerState.Stop;
        }
        /// <summary>
        /// Stops receiving the WebSocket connection requests.
        /// </summary>
        public async Task Stop()
        {
            var msg = _state.CheckIfStart();

            if (msg != null)
            {
                return;
            }

            _state = ServerState.ShuttingDown;

            StopReceiving();
            await _services.Stop(new CloseEventArgs(), true, true).ConfigureAwait(false);

            _state = ServerState.Stop;
        }
Beispiel #5
0
        private void stop(ushort code, string reason)
        {
            var data = code.Append(reason);

            if (data.Length > 125)
            {
                var msg = "The payload length of a Close frame must be 125 bytes or less.";
                Log.Error(String.Format("{0}\ncode: {1}\nreason: {2}", msg, code, reason));
                Error(msg);

                return;
            }

            base.Stop();
            _sessions.Stop(code, reason);
        }
Beispiel #6
0
        private void abort()
        {
            lock (_sync) {
                if (!IsListening)
                {
                    return;
                }

                _state = ServerState.ShuttingDown;
            }

            _listener.Stop();
            _services.Stop(
                ((ushort)CloseStatusCode.ServerError).ToByteArrayInternally(ByteOrder.Big), true);

            _state = ServerState.Stop;
        }
Beispiel #7
0
 /// <summary>
 /// Stops receiving the WebSocket connection requests.
 /// </summary>
 public override void Stop()
 {
     base.Stop();
     _sessions.Stop();
 }