summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2020-04-16 18:27:26 +0300
committerAndrei Belov <defan@nginx.com>2020-04-16 18:27:26 +0300
commit74f32d26b91f49d3392605e81c1597b375890b60 (patch)
treeadfc67dfc86461441bde65512f745ce27bd6ea28 /src/nodejs
parent2ff9df10ef1df43c935c870175e52473dad2c21a (diff)
parent9877087756144d3bdf343d0d4e91e1efbcc62c93 (diff)
downloadunit-74f32d26b91f49d3392605e81c1597b375890b60.tar.gz
unit-74f32d26b91f49d3392605e81c1597b375890b60.tar.bz2
Merged with the default branch.1.17.0-1
Diffstat (limited to 'src/nodejs')
-rw-r--r--src/nodejs/unit-http/http_server.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js
index 2f324329..d378e410 100644
--- a/src/nodejs/unit-http/http_server.js
+++ b/src/nodejs/unit-http/http_server.js
@@ -451,8 +451,18 @@ Server.prototype.setTimeout = function setTimeout(msecs, callback) {
return this;
};
-Server.prototype.listen = function () {
+Server.prototype.listen = function (...args) {
this.unit.listen();
+
+ const cb = args.pop();
+
+ if (typeof cb === 'function') {
+ this.once('listening', cb);
+ }
+
+ this.emit('listening');
+
+ return this;
};
Server.prototype.emit_request = function (req, res) {