Skip to content

Commit 82e4a43

Browse files
committed
fix: exclude low level send events from being cloned upwards
1 parent 18df157 commit 82e4a43

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/QUICClient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,11 @@ class QUICClient {
393393
* Registered only if the socket is encapsulated.
394394
*/
395395
protected handleEventQUICSocket = (evt: EventAll) => {
396-
if (evt.detail instanceof AbstractEvent) {
396+
if (
397+
evt.detail instanceof AbstractEvent &&
398+
// Avoid cloning the `EventQUICConnectionSend` event as it's very low level
399+
!(evt.detail instanceof events.EventQUICConnectionSend)
400+
) {
397401
this.dispatchEvent(evt.detail.clone());
398402
}
399403
};

src/QUICConnection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ class QUICConnection {
229229
* Handles all `EventQUICStream` events.
230230
*/
231231
protected handleEventQUICStream = (evt: EventAll) => {
232-
if (evt.detail instanceof AbstractEvent) {
232+
if (
233+
evt.detail instanceof AbstractEvent &&
234+
// Avoid cloning the `EventQUICStreamSend` event as it's very low level
235+
!(evt.detail instanceof events.EventQUICStreamSend)
236+
) {
233237
this.dispatchEvent(evt.detail.clone());
234238
}
235239
};

src/QUICServer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ class QUICServer {
168168
* Handles all `EventQUICConnection` events.
169169
*/
170170
protected handleEventQUICConnection = (evt: EventAll) => {
171-
if (evt.detail instanceof AbstractEvent) {
171+
if (
172+
evt.detail instanceof AbstractEvent &&
173+
// Avoid cloning the `EventQUICConnectionSend` event as it's very low level
174+
!(evt.detail instanceof events.EventQUICConnectionSend)
175+
) {
172176
this.dispatchEvent(evt.detail.clone());
173177
}
174178
};

0 commit comments

Comments
 (0)