Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 247dfb7

Browse filesBrowse files
vramanatargos
authored andcommitted
dgram: fix unhandled exception aborting a closed udp socket
Fixes: #46750 PR-URL: #46770 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 92f2f19 commit 247dfb7
Copy full SHA for 247dfb7

File tree

Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed
Open diff view settings
Collapse file

‎lib/dgram.js‎

Copy file name to clipboardExpand all lines: lib/dgram.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function Socket(type, listener) {
139139
const { signal } = options;
140140
validateAbortSignal(signal, 'options.signal');
141141
const onAborted = () => {
142-
this.close();
142+
if (this[kStateSymbol].handle) this.close();
143143
};
144144
if (signal.aborted) {
145145
onAborted();
Collapse file
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
const dgram = require('dgram');
4+
5+
const controller = new AbortController();
6+
const socket = dgram.createSocket({ type: 'udp4', signal: controller.signal });
7+
8+
socket.close();
9+
10+
controller.abort();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.