Ejemplo n.º 1
0
 public void FinishDecode(IoSession session, IProtocolDecoderOutput output)
 {
     lock (_decoder)
     {
         _decoder.FinishDecode(session, output);
     }
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void SessionClosed(INextFilter nextFilter, IoSession session)
        {
            // Call finishDecode() first when a connection is closed.
            IProtocolDecoder       decoder    = _factory.GetDecoder(session);
            IProtocolDecoderOutput decoderOut = GetDecoderOut(session, nextFilter);

            try
            {
                decoder.FinishDecode(session, decoderOut);
            }
            catch (Exception ex)
            {
                ProtocolDecoderException pde = ex as ProtocolDecoderException;
                if (pde == null)
                {
                    pde = new ProtocolDecoderException(null, ex);
                }
                throw pde;
            }
            finally
            {
                // Dispose everything
                DisposeCodec(session);
                decoderOut.Flush(nextFilter, session);
            }

            // Call the next filter
            nextFilter.SessionClosed(session);
        }