Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/node-async-redis/node_modules/redis-parser/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict'
var hiredis = require('hiredis')
var ReplyError = require('../lib/replyError')
var ParserError = require('../lib/parserError')
/**
* Parse data
* @param parser
* @returns {*}
*/
function parseData (parser, data) {
try {
return parser.reader.get()
} catch (err) {
// Protocol errors land here
// Reset the parser. Otherwise new commands can't be processed properly
parser.reader = new hiredis.Reader(parser.options)
parser.returnFatalError(new ParserError(err.message, JSON.stringify(data), -1))
}
}
/**
* Hiredis Parser
* @param options
* @constructor
*/
function HiredisReplyParser (options) {
this.returnError = options.returnError
this.returnFatalError = options.returnFatalError || options.returnError
this.returnReply = options.returnReply
this.name = 'hiredis'
this.options = {
return_buffers: !!options.returnBuffers
}
this.reader = new hiredis.Reader(this.options)
}
HiredisReplyParser.prototype.execute = function (data) {
this.reader.feed(data)
var reply = parseData(this, data)
while (reply !== undefined) {
if (reply && reply.name === 'Error') {
this.returnError(new ReplyError(reply.message))
} else {
this.returnReply(reply)
}
reply = parseData(this, data)
}
}
/**
* Reset the parser values to the initial state
*
* @returns {undefined}
*/
HiredisReplyParser.prototype.reset = function () {
this.reader = new hiredis.Reader(this.options)
}
module.exports = HiredisReplyParser
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0051 ]-- |