Commit e253edb
committed
src: make CleanupHandles() tear down handles/reqs
Previously, handles would not be closed when the current `Environment`
stopped, which is acceptable in a single-`Environment`-per-process
situation, but would otherwise create memory and file descriptor
leaks.
Also, introduce a generic way to close handles via the
`Environment::CloseHandle()` function, which automatically keeps
track of whether a close callback has been called yet or not.
Many thanks for Stephen Belanger for reviewing the original version of
this commit in the Ayo.js project.
Refs: ayojs/ayo#85
PR-URL: #19377
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent ba26958 commit e253edbCopy full SHA for e253edb
File tree
Expand file treeCollapse file tree
13 files changed
+90
-45
lines changedOpen diff view settings
Filter options
- src
Expand file treeCollapse file tree
13 files changed
+90
-45
lines changedOpen diff view settings
Collapse file
+6-12Lines changed: 6 additions & 12 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
267 | 267 | |
268 | 268 | |
269 | 269 | |
270 | | - |
271 | | - |
272 | | - |
| 270 | + |
| 271 | + |
273 | 272 | |
274 | 273 | |
275 | 274 | |
| ||
347 | 346 | |
348 | 347 | |
349 | 348 | |
350 | | - |
351 | | - |
| 349 | + |
352 | 350 | |
353 | 351 | |
354 | 352 | |
| ||
517 | 515 | |
518 | 516 | |
519 | 517 | |
520 | | - |
521 | | - |
522 | | - |
523 | | - |
| 518 | + |
524 | 519 | |
525 | 520 | |
526 | 521 | |
| ||
610 | 605 | |
611 | 606 | |
612 | 607 | |
613 | | - |
614 | | - |
| 608 | + |
615 | 609 | |
616 | 610 | |
617 | 611 | |
| ||
636 | 630 | |
637 | 631 | |
638 | 632 | |
639 | | - |
| 633 | + |
640 | 634 | |
641 | 635 | |
642 | 636 | |
|
Collapse file
-2Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | | - |
27 | | - |
28 | 26 | |
29 | 27 | |
30 | 28 | |
|
Collapse file
+20-2Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
349 | 349 | |
350 | 350 | |
351 | 351 | |
352 | | - |
353 | | - |
| 352 | + |
| 353 | + |
| 354 | + |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
| 359 | + |
| 360 | + |
| 361 | + |
| 362 | + |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | + |
| 367 | + |
| 368 | + |
| 369 | + |
| 370 | + |
| 371 | + |
354 | 372 | |
355 | 373 | |
356 | 374 | |
|
Collapse file
+12-8Lines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
209 | 209 | |
210 | 210 | |
211 | 211 | |
212 | | - |
213 | | - |
214 | | - |
| 212 | + |
215 | 213 | |
216 | 214 | |
217 | 215 | |
| ||
233 | 231 | |
234 | 232 | |
235 | 233 | |
236 | | - |
237 | | - |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
238 | 241 | |
239 | | - |
240 | 242 | |
241 | 243 | |
242 | | - |
| 244 | + |
243 | 245 | |
244 | 246 | |
245 | 247 | |
| ||
306 | 308 | |
307 | 309 | |
308 | 310 | |
| 311 | + |
| 312 | + |
309 | 313 | |
310 | 314 | |
311 | 315 | |
| ||
329 | 333 | |
330 | 334 | |
331 | 335 | |
332 | | - |
333 | 336 | |
| 337 | + |
334 | 338 | |
335 | 339 | |
336 | 340 | |
|
Collapse file
+5-1Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
577 | 577 | |
578 | 578 | |
579 | 579 | |
| 580 | + |
| 581 | + |
580 | 582 | |
581 | 583 | |
582 | 584 | |
583 | | - |
| 585 | + |
| 586 | + |
| 587 | + |
584 | 588 | |
585 | 589 | |
586 | 590 | |
|
Collapse file
+4-2Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | | - |
| 81 | + |
| 82 | + |
| 83 | + |
82 | 84 | |
83 | 85 | |
84 | 86 | |
85 | | - |
86 | 87 | |
87 | 88 | |
88 | 89 | |
| ||
153 | 154 | |
154 | 155 | |
155 | 156 | |
| 157 | + |
156 | 158 | |
157 | 159 | |
158 | 160 | |
|
Collapse file
+25-12Lines changed: 25 additions & 12 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | | - |
65 | | - |
66 | 64 | |
67 | 65 | |
68 | 66 | |
69 | | - |
70 | | - |
71 | | - |
| 67 | + |
| 68 | + |
72 | 69 | |
73 | | - |
| 70 | + |
| 71 | + |
74 | 72 | |
75 | 73 | |
76 | | - |
77 | | - |
78 | | - |
| 74 | + |
| 75 | + |
| 76 | + |
79 | 77 | |
80 | | - |
81 | | - |
82 | | - |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
83 | 82 | |
84 | 83 | |
85 | 84 | |
86 | 85 | |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
87 | 98 | |
88 | 99 | |
89 | 100 | |
| ||
110 | 121 | |
111 | 122 | |
112 | 123 | |
| 124 | + |
| 125 | + |
113 | 126 | |
114 | 127 | |
115 | 128 | |
|
Collapse file
+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
70 | 70 | |
71 | 71 | |
72 | 72 | |
| 73 | + |
| 74 | + |
73 | 75 | |
74 | 76 | |
75 | 77 | |
76 | 78 | |
77 | 79 | |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
78 | 84 | |
79 | 85 | |
80 | 86 | |
|
Collapse file
+1-6Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | 78 | |
84 | 79 | |
85 | 80 | |
| ||
93 | 88 | |
94 | 89 | |
95 | 90 | |
96 | | - |
| 91 | + |
97 | 92 | |
98 | 93 | |
99 | 94 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
88 | 88 | |
89 | 89 | |
90 | 90 | |
| 91 | + |
91 | 92 | |
92 | 93 | |
93 | 94 | |
| ||
256 | 257 | |
257 | 258 | |
258 | 259 | |
| 260 | + |
259 | 261 | |
260 | 262 | |
261 | 263 | |
|
0 commit comments