Prevented server crash, while FastCGI service is unavailable.
This commit is contained in:
parent
ea8def69d9
commit
d7bae6df69
1 changed files with 3 additions and 3 deletions
6
index.js
6
index.js
|
@ -251,13 +251,13 @@ function createFastCGIHandler(options) {
|
|||
});
|
||||
|
||||
function stdoutPush(data) {
|
||||
var toResume = (stdoutBuffer.length == 0);
|
||||
if(data === null) {
|
||||
stdoutToEnd = true;
|
||||
} else {
|
||||
var toResume = (stdoutBuffer.length == 0);
|
||||
stdoutBuffer = Buffer.concat([stdoutBuffer, Buffer.from(data)]);
|
||||
if(toResume) emulatedStdout.resume();
|
||||
}
|
||||
if(toResume) emulatedStdout.resume();
|
||||
}
|
||||
|
||||
var stdoutBuffer = Buffer.alloc(0);
|
||||
|
@ -305,7 +305,7 @@ function createFastCGIHandler(options) {
|
|||
var socket = net.createConnection(options, function () {
|
||||
eventEmitter.emit("connect");
|
||||
}).on("error", function (err) {
|
||||
stdoutBuffer.push(null);
|
||||
stdoutPush(null);
|
||||
emulatedStderr.push(null);
|
||||
eventEmitter.removeAllListeners("exit");
|
||||
eventEmitter.emit("error", err);
|
||||
|
|
Loading…
Reference in a new issue