mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 07:27:49 +00:00

Added a listening property into net.Server.prototype indicating if the server is listening or not for connections. Other Server constructors that rely on net.Server should also gain access to this property. Also included tests for net and http subsystems. PR-URL: https://github.com/nodejs/node/pull/4743 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
17 lines
397 B
JavaScript
17 lines
397 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer();
|
|
|
|
assert.strictEqual(server.listening, false);
|
|
|
|
server.listen(common.PORT, common.mustCall(() => {
|
|
assert.strictEqual(server.listening, true);
|
|
|
|
server.close(common.mustCall(() => {
|
|
assert.strictEqual(server.listening, false);
|
|
}));
|
|
}));
|