mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
pass test/js/node/test/parallel/test-https-server-close-destroy-timeout.js
This commit is contained in:
@@ -48,6 +48,7 @@ const { format } = require("internal/util/inspect");
|
||||
const { IncomingMessage } = require("node:_http_incoming");
|
||||
const { OutgoingMessage } = require("node:_http_outgoing");
|
||||
const { kIncomingMessage } = require("node:_http_common");
|
||||
const kConnectionsCheckingInterval = Symbol("http.server.connectionsCheckingInterval");
|
||||
|
||||
const getBunServerAllClosedPromise = $newZigFunction("node_http_binding.zig", "getBunServerAllClosedPromise", 1);
|
||||
const sendHelper = $newZigFunction("node_cluster_binding.zig", "sendHelperChild", 3);
|
||||
@@ -709,6 +710,7 @@ const ServerPrototype = {
|
||||
__proto__: EventEmitter.prototype,
|
||||
[kIncomingMessage]: undefined,
|
||||
[kServerResponse]: undefined,
|
||||
[kConnectionsCheckingInterval]: { _destroyed: false },
|
||||
ref() {
|
||||
this._unref = false;
|
||||
this[serverSymbol]?.ref?.();
|
||||
@@ -741,6 +743,7 @@ const ServerPrototype = {
|
||||
return;
|
||||
}
|
||||
this[serverSymbol] = undefined;
|
||||
this[kConnectionsCheckingInterval]._destroyed = true;
|
||||
if (typeof optionalCallback === "function") setCloseCallback(this, optionalCallback);
|
||||
server.stop();
|
||||
},
|
||||
@@ -1721,4 +1724,5 @@ function ensureReadableStreamController(run) {
|
||||
export default {
|
||||
Server,
|
||||
ServerResponse,
|
||||
kConnectionsCheckingInterval,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
if (!common.hasCrypto) {
|
||||
common.skip('missing crypto');
|
||||
}
|
||||
|
||||
const { createServer } = require('https');
|
||||
const { kConnectionsCheckingInterval } = require('_http_server');
|
||||
|
||||
const fixtures = require('../common/fixtures');
|
||||
|
||||
const options = {
|
||||
key: fixtures.readKey('agent1-key.pem'),
|
||||
cert: fixtures.readKey('agent1-cert.pem')
|
||||
};
|
||||
|
||||
const server = createServer(options, function(req, res) {});
|
||||
server.listen(0, common.mustCall(function() {
|
||||
assert.strictEqual(server[kConnectionsCheckingInterval]._destroyed, false);
|
||||
server.close(common.mustCall(() => {
|
||||
assert(server[kConnectionsCheckingInterval]._destroyed);
|
||||
}));
|
||||
}));
|
||||
Reference in New Issue
Block a user