Commit e2c8c23
[io] Fix
When shutting down receive direction we need to ensure that
`closedRead` event is dispatched - as the receive direction
is only considered closed if the available data is drained
and `closedRead` is dispatched.
The code did not account for a possibility that socket has
no available data and as such is not dispatching read events
so closing receive direction and then separately closing
send direction would leave the socket in a state where
both directions are closed but the socket is not disposed
because `closedRead` is not dispatched - such socket objects
will simply leak (even if the other side terminates
the connection).
This CL also updates documentation around `RawSocket.shutdown`
and `RawSocket.readEventsEnabled` to make it clear that
users are responsible for draining accumulated data if
they want to shutdown receive direction.
Fixes #27414
TEST=standalone/io/issue_27414
CoreLibraryReviewExempt: Documentation only changes in VM specific library
Change-Id: I4b0ffb4cc67836c2849ec6e49b788a4f3b4c07d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396340
Reviewed-by: Brian Quinlan <[email protected]>
Commit-Queue: Slava Egorov <[email protected]>_NativeSocket.shutdownRead
1 parent c872db1 commit e2c8c23
File tree
4 files changed
+111
-6
lines changed- sdk/lib
- _internal/vm/bin
- io
- tests/standalone/io
4 files changed
+111
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1626 | 1630 | | |
1627 | 1631 | | |
1628 | 1632 | | |
1629 | 1633 | | |
| 1634 | + | |
1630 | 1635 | | |
1631 | 1636 | | |
| 1637 | + | |
1632 | 1638 | | |
1633 | 1639 | | |
1634 | 1640 | | |
1635 | 1641 | | |
1636 | 1642 | | |
| 1643 | + | |
1637 | 1644 | | |
1638 | 1645 | | |
1639 | | - | |
1640 | 1646 | | |
| 1647 | + | |
| 1648 | + | |
1641 | 1649 | | |
1642 | 1650 | | |
1643 | 1651 | | |
| |||
1846 | 1854 | | |
1847 | 1855 | | |
1848 | 1856 | | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
1849 | 1860 | | |
1850 | 1861 | | |
1851 | 1862 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
623 | 628 | | |
624 | 629 | | |
625 | 630 | | |
| |||
636 | 641 | | |
637 | 642 | | |
638 | 643 | | |
639 | | - | |
640 | | - | |
| 644 | + | |
| 645 | + | |
641 | 646 | | |
642 | 647 | | |
643 | 648 | | |
| |||
788 | 793 | | |
789 | 794 | | |
790 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
791 | 807 | | |
792 | 808 | | |
793 | 809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
| 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 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments