def process_reset_session(session, connection_initialize = false)
      # set active command sequence info
      session[:cmd_sequence] = connection_initialize ? :CMD_HELO : :CMD_RSET
      # drop any auth challenge
      session[:auth_challenge] = {}
      # test existing of :ctx hash
      session[:ctx] || session[:ctx] = {}
      # reset server values (only on connection start)
      if connection_initialize
        # create or rebuild :ctx hash
        session[:ctx].merge!(
          server: {
            local_host: '',
            local_ip: '',
            local_port: '',
            local_response: '',
            remote_host: '',
            remote_ip: '',
            remote_port: '',
            helo: '',
            helo_response: '',
            connected: '',
            exceptions: 0,
            authorization_id: '',
            authentication_id: '',
            authenticated: '',
            encrypted: ''
          }
        )
      end
      # reset envelope values
      session[:ctx].merge!(
        envelope: {
          from: '',
          to: [],
          encoding_body: '',
          encoding_utf8: ''
        }
      )
      # reset message data
      session[:ctx].merge!(
        message: {
          received: -1,
          delivered: -1,
          bytesize: -1,
          headers: '',
          crlf: "\r\n",
          data: ''
        }
      )
    end
def process_reset_session(session, connection_initialize = false)
      # set active command sequence info
      session[:cmd_sequence] = connection_initialize ? :CMD_HELO : :CMD_RSET
      # drop any auth challenge
      session[:auth_challenge] = {}
      # test existing of :ctx hash
      session[:ctx] || session[:ctx] = {}
      # reset server values (only on connection start)
      if connection_initialize
        # create or rebuild :ctx hash
        session[:ctx].merge!(
          server: {
            local_host: '',
            local_ip: '',
            local_port: '',
            local_response: '',
            remote_host: '',
            remote_ip: '',
            remote_port: '',
            helo: '',
            helo_response: '',
            connected: '',
            exceptions: 0,
            authorization_id: '',
            authentication_id: '',
            authenticated: '',
            encrypted: ''
          }
        )
      end
      # reset envelope values
      session[:ctx].merge!(
        envelope: {
          from: '',
          to: [],
          encoding_body: '',
          encoding_utf8: ''
        }
      )
      # reset message data
      session[:ctx].merge!(
        message: {
          received: -1,
          delivered: -1,
          bytesize: -1,
          headers: '',
          crlf: "\r\n",
          data: ''
        }
      )
    end
reset the context of current smtpd dialog