Skip to content

Commit

Permalink
wip: fixed up benchmark
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
tegefaulkes committed Jul 6, 2023
1 parent cefe4ac commit 20aee5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
31 changes: 15 additions & 16 deletions benches/stream_1KB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ async function main() {
),
]);
// Setting up initial state
const crypto = {
key: await testsUtils.generateKey(),
ops: {
sign: testsUtils.sign,
verify: testsUtils.verify,
randomBytes: testsUtils.randomBytes,
},
};

const data1KiB = Buffer.alloc(1024, 0xf0);
const host = '127.0.0.1' as Host;
const certChainPem = await fs.promises.readFile(
Expand All @@ -36,14 +27,18 @@ async function main() {

const quicServer = new QUICServer({
config: {
tlsConfig: {
privKeyPem: privKeyPem.toString(),
certChainPem: certChainPem.toString(),
},
key: privKeyPem.toString(),
cert: certChainPem.toString(),
verifyPeer: false,
keepAliveIntervalTime: 1000,
},
crypto: {
key: await testsUtils.generateKeyHMAC(),
ops: {
sign: testsUtils.signHMAC,
verify: testsUtils.verifyHMAC,
},
},
keepaliveIntervalTime: 1000,
crypto,
logger,
});
quicServer.addEventListener(
Expand Down Expand Up @@ -80,7 +75,11 @@ async function main() {
host,
port: quicServer.port,
localHost: host,
crypto,
crypto: {
ops: {
randomBytes: testsUtils.randomBytes,
},
},
logger,
});

Expand Down
6 changes: 3 additions & 3 deletions src/QUICServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import QUICSocket from './QUICSocket';
import { never } from './utils';

/**
* You must provide a error handler `addEventListener('error')`.
* Otherwise errors will just be ignored.
* You must provide an error handler `addEventListener('error')`.
* Otherwise, errors will just be ignored.
*
* Events:
* - serverStop
Expand Down Expand Up @@ -221,7 +221,7 @@ class QUICServer extends EventTarget {
errorMessage: 'cleaning up connections',
force,
}),
); // TODO: fill in with proper details
);
}
this.logger.debug('Awaiting connections to destroy');
await Promise.all(destroyProms);
Expand Down

0 comments on commit 20aee5c

Please sign in to comment.