def check_message_length(frame)
      if frame[:command] == "close"
        real_length = frame[:message].length
      else
        real_length = frame[:message].length - 2
      end
      if real_length != frame[:data_length].to_i
        @logger.error 'Lost data'
        raise Relp::MissingData.new('Data length is not same as received data')
      end
    end
def check_message_length(frame)
      if frame[:command] == "close"
        real_length = frame[:message].length
      else
        real_length = frame[:message].length - 2
      end
      if real_length != frame[:data_length].to_i
        @logger.error 'Lost data'
        raise Relp::MissingData.new('Data length is not same as received data')
      end
    end
IN PROGRESS!
 TODO: find how exactly relp behaves under high load (batch processing
 and adjust this function accordingly, probably more elaborate logic and
 some dynamic offset corrections will be needed