mirror of
https://github.com/bitinflow/server.git
synced 2026-03-13 13:35:53 +00:00
make done a no-op if not provided
This commit is contained in:
@@ -60,17 +60,18 @@ function maybe_bounce(req, res, bounce) {
|
|||||||
|
|
||||||
// get client port
|
// get client port
|
||||||
client.next_socket(function(socket, done) {
|
client.next_socket(function(socket, done) {
|
||||||
|
done = done || function() {};
|
||||||
|
|
||||||
// the request already finished or client disconnected
|
// the request already finished or client disconnected
|
||||||
if (finished) {
|
if (finished) {
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
|
|
||||||
// happens when client upstream is disconnected
|
// happens when client upstream is disconnected
|
||||||
// we gracefully inform the user and kill their conn
|
// we gracefully inform the user and kill their conn
|
||||||
// without this, the browser will leave some connections open
|
// without this, the browser will leave some connections open
|
||||||
// and try to use them again for new requests
|
// and try to use them again for new requests
|
||||||
// we cannot have this as we need bouncy to assign the requests again
|
// we cannot have this as we need bouncy to assign the requests again
|
||||||
if (!socket) {
|
else if (!socket) {
|
||||||
res.statusCode = 504;
|
res.statusCode = 504;
|
||||||
res.end();
|
res.end();
|
||||||
req.connection.destroy();
|
req.connection.destroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user