Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
quic: fix lint issues
Browse files Browse the repository at this point in the history
PR-URL: #213
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell authored and addaleax committed Dec 11, 2019
1 parent ed6a4d0 commit 048cdcb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 31 deletions.
5 changes: 2 additions & 3 deletions doc/api/quic.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const { createSocket } = require('quic');
// Create a QuicSocket associated with localhost and port 1234
const socket = createSocket({ port: 1234 });

const client = client.connect({
const client = socket.connect({
address: 'example.com',
port: 4567,
alpn: 'foo'
Expand All @@ -131,7 +131,7 @@ New instance of `QuicServerSession` are created internally by the
`QuicSocket` if it has been configured to listen for new connections
using the `listen()` method.

```
```js
const key = getTLSKeySomehow();
const cert = getTLSCertSomehow();

Expand Down Expand Up @@ -405,7 +405,6 @@ added: REPLACEME
An object containing the local address information for the `QuicSocket` to which
the `QuicSession` is currently associated.


#### quicsession.alpnProtocol
<!-- YAML
added: REPLACEME
Expand Down
35 changes: 18 additions & 17 deletions lib/internal/quic/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ const {
IDX_QUIC_SESSION_STATS_MAX_BYTES_IN_FLIGHT,
IDX_QUIC_SESSION_STATS_BLOCK_COUNT,
IDX_QUIC_STREAM_STATS_CREATED_AT,
IDX_QUIC_STREAM_STATS_SENT_AT,
IDX_QUIC_STREAM_STATS_RECEIVED_AT,
IDX_QUIC_STREAM_STATS_ACKED_AT,
IDX_QUIC_STREAM_STATS_CLOSING_AT,
IDX_QUIC_STREAM_STATS_BYTES_RECEIVED,
IDX_QUIC_STREAM_STATS_BYTES_SENT,
IDX_QUIC_STREAM_STATS_MAX_OFFSET,
Expand Down Expand Up @@ -262,7 +258,7 @@ function setTransportParams(config) {
maxPacketSize,
maxAckDelay,
maxCryptoBuffer,
h3 : {
h3: {
qpackMaxTableCapacity,
qpackBlockedStreams,
maxHeaderListSize,
Expand Down Expand Up @@ -1382,6 +1378,11 @@ class QuicSocket extends EventEmitter {
return stats[IDX_QUIC_SOCKET_STATS_PACKETS_SENT];
}

get packetsIgnored() {
const stats = this.#stats || this[kHandle].stats;
return stats[IDX_QUIC_SOCKET_STATS_PACKETS_IGNORED];
}

get serverBusy() {
return this.#serverBusy;
}
Expand Down Expand Up @@ -2641,14 +2642,14 @@ class QuicStream extends Duplex {
let validator;
if (this.session instanceof QuicServerSession) {
validator =
this.clientInitiated ?
assertValidPseudoHeaderResponse :
assertValidPseudoHeader;
this.clientInitiated ?
assertValidPseudoHeaderResponse :
assertValidPseudoHeader;
} else { // QuicClientSession
validator =
this.clientInitiated ?
assertValidPseudoHeader :
assertValidPseudoHeaderResponse;
this.clientInitiated ?
assertValidPseudoHeader :
assertValidPseudoHeaderResponse;
}

return this[kHandle].submitInformationalHeaders(
Expand Down Expand Up @@ -2676,14 +2677,14 @@ class QuicStream extends Duplex {
let validator;
if (this.session instanceof QuicServerSession) {
validator =
this.clientInitiated ?
assertValidPseudoHeaderResponse :
assertValidPseudoHeader;
this.clientInitiated ?
assertValidPseudoHeaderResponse :
assertValidPseudoHeader;
} else { // QuicClientSession
validator =
this.clientInitiated ?
assertValidPseudoHeader :
assertValidPseudoHeaderResponse;
this.clientInitiated ?
assertValidPseudoHeader :
assertValidPseudoHeaderResponse;
}

return this[kHandle].submitHeaders(
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/quic/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function validateTransportParams(params) {
preferredAddress,
rejectUnauthorized,
requestCert,
h3 : {
h3: {
qpackMaxTableCapacity,
qpackBlockedStreams,
maxHeaderListSize,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-quic-client-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ server.on('session', common.mustCall((session) => {
// cause anything else to fail.

// TODO(@jasnell): Move updateKey to a separate test
//setTimeout(() => assert(session.updateKey()), 500);
// setTimeout(() => assert(session.updateKey()), 500);

debug('QuicServerSession TLS Handshake Complete');
debug(' Server name: %s', servername);
Expand Down
9 changes: 0 additions & 9 deletions test/parallel/test-quic-http3-client-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ const common = require('../common');
if (!common.hasQuic)
common.skip('missing quic');

const { internalBinding } = require('internal/test/binding');
const {
constants: {
NGTCP2_NO_ERROR,
QUIC_ERROR_APPLICATION,
}
} = internalBinding('quic');

const Countdown = require('../common/countdown');
const assert = require('assert');
const fs = require('fs');
Expand All @@ -35,7 +27,6 @@ const kClientPort = process.env.NODE_DEBUG_KEYLOG ? 5679 : 0;
let client;
const server = createSocket({ port: kServerPort, validateAddress: true });

const unidata = ['I wonder if it worked.', 'test'];
const kServerName = 'agent2'; // Intentionally the wrong servername
const kALPN = 'h3-24';

Expand Down

0 comments on commit 048cdcb

Please sign in to comment.