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

Commit

Permalink
quic: expose retransmit counts to JS
Browse files Browse the repository at this point in the history
Allows monitoring the number of times packets have to be
retransmitted because of loss or delayed ack. An implementation
experiencing a high number of retransmits may need to be torn
down or mitigated in some way. This allows the user code to keep
track. Later, we may want to add a setting that enforces a maximum
number of retransmissions before failing a connection.

Fixes: #78
PR-URL: #207
Reviewed-By: #207
  • Loading branch information
jasnell authored and addaleax committed Dec 11, 2019
1 parent cbbf74e commit a8d5f29
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/internal/quic/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ const {
IDX_QUIC_SESSION_STATS_STREAMS_IN_COUNT,
IDX_QUIC_SESSION_STATS_STREAMS_OUT_COUNT,
IDX_QUIC_SESSION_STATS_KEYUPDATE_COUNT,
IDX_QUIC_SESSION_STATS_LOSS_RETRANSMIT_COUNT,
IDX_QUIC_SESSION_STATS_ACK_DELAY_RETRANSMIT_COUNT,
IDX_QUIC_SESSION_STATS_MAX_BYTES_IN_FLIGHT,
ERR_INVALID_REMOTE_TRANSPORT_PARAMS,
ERR_INVALID_TLS_SESSION_TICKET,
Expand Down Expand Up @@ -1864,6 +1866,16 @@ class QuicSession extends EventEmitter {
return stats[IDX_QUIC_SESSION_STATS_MAX_BYTES_IN_FLIGHT];
}

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

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

get peerInitiatedStreamCount() {
const stats = this.#stats || this[kHandle].stats;
return stats[IDX_QUIC_SESSION_STATS_STREAMS_IN_COUNT];
Expand Down

0 comments on commit a8d5f29

Please sign in to comment.