Close() private méthode

private Close ( ) : void
Résultat void
Exemple #1
0
        private void processAlert()
        {
            while (alertQueue.Available >= 2)
            {
                /*
                 * An alert is always 2 bytes. Read the alert.
                 */
                byte[] tmp = new byte[2];
                alertQueue.Read(tmp, 0, 2, 0);
                alertQueue.RemoveData(2);
                short level       = tmp[0];
                short description = tmp[1];
                if (level == AL_fatal)
                {
                    /*
                     * This is a fatal error.
                     */
                    this.failedWithError = true;
                    this.closed          = true;

                    /*
                     * Now try to Close the stream, ignore errors.
                     */
                    try
                    {
                        rs.Close();
                    }
                    catch (Exception)
                    {
                    }
                    throw new IOException(TLS_ERROR_MESSAGE);
                }
                else
                {
                    /*
                     * This is just a warning.
                     */
                    if (description == AP_close_notify)
                    {
                        /*
                         * Close notify
                         */
                        this.FailWithError(AL_warning, AP_close_notify);
                    }

                    /*
                     * If it is just a warning, we continue.
                     */
                }
            }
        }
Exemple #2
0
        private void ProcessAlert()
        {
            while (alertQueue.Available >= 2)
            {
                /*
                 * An alert is always 2 bytes. Read the alert.
                 */
                byte[] tmp         = alertQueue.RemoveData(2, 0);
                byte   level       = tmp[0];
                byte   description = tmp[1];
                if (level == (byte)AlertLevel.fatal)
                {
                    this.failedWithError = true;
                    this.closed          = true;

                    /*
                     * Now try to Close the stream, ignore errors.
                     */
                    try
                    {
                        rs.Close();
                    }
                    catch (Exception)
                    {
                    }
                    throw new IOException(TLS_ERROR_MESSAGE);
                }
                else
                {
                    if (description == (byte)AlertDescription.close_notify)
                    {
                        HandleClose(false);
                    }

                    /*
                     * If it is just a warning, we continue.
                     */
                }
            }
        }