Commit d8371a8
http_server: fix resume after socket close
Socket resume may happen on a next tick, and in following scenario:
1. `socket.resume()`
2. `socket._handle.close()`
3. `socket._handle = null;`
The `_resume` will be invoked with empty `._handle` property. There is
nothing bad about it, and we should just ignore the `resume`/`pause`
events in this case.
Same applies to the unconsuming of socket on adding `data` and/or
`readable` event listeners.
Fix: #2821
PR-URL: #2824
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>1 parent 777eb00 commit d8371a8Copy full SHA for d8371a8
File tree
Expand file treeCollapse file tree
2 files changed
+29
-3
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+29
-3
lines changedOpen diff view settings
Collapse file
+5-3Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
512 | 512 | |
513 | 513 | |
514 | 514 | |
515 | | - |
| 515 | + |
| 516 | + |
516 | 517 | |
517 | 518 | |
518 | 519 | |
519 | | - |
| 520 | + |
| 521 | + |
520 | 522 | |
521 | 523 | |
522 | 524 | |
| ||
526 | 528 | |
527 | 529 | |
528 | 530 | |
529 | | - |
| 531 | + |
530 | 532 | |
531 | 533 | |
532 | 534 | |
|
Collapse file
test/parallel/test-http-regr-gh-2821.js
Copy file name to clipboard+24Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
0 commit comments