Commit 2bd3262
committed
Extend listen-socket to epoll and kqueue transports
The `existing-channel` option added in clj-commons#748 works only with NIO
transport (Aleph default). When trying to use it with epoll, we would
get a Netty error: `incompatible event loop type:
io.netty.channel.epoll.EpollEventLoop`.
This is not surprising, since the server-channel class to use depends
on the transport, as per
[`transport-server-channel-class`](https://github.com/clj-commons/aleph/blob/5a0c6976aa42f30ca3786cef64f9ba70cf037ae1/src/aleph/netty.clj#L1327)
and the `existing-channel` handling was always creating a NIO
server-channel regardless of transport.
It’s not difficult to support most of the other transports. We just
have to use the server-channel class as per the aforementioned fn.
Their constructors in case of epoll and kqueue take an FD number
rather than Java channel. There is no suitable constructor for
io-uring, so it is not supported. The validation has been updated
accordingly.
The full integration test is still limited to NIO, because obtaining
an FD of a server-socket opened in Java requires deep reflection
(the `--add-opens` flag), which would add some complexity (perhaps a
dedicated lein profile) just to test this. The validation test checks
that the FD route is attempted for the other transports, but it stops
at `Bad file descriptor` error.
The option is being renamed from `existing-channel` to
`listen-socket`, because this seems more fitting when we are accepting
not just channels but also FDs. The `existing-channel` was merged very
recently and hasn’t yet been released in a maven version.1 parent 5a0c697 commit 2bd3262
File tree
6 files changed
+100
-50
lines changed- src/aleph
- http
- test/aleph
6 files changed
+100
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
740 | | - | |
| 740 | + | |
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | | - | |
| 792 | + | |
| 793 | + | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1331 | 1331 | | |
1332 | 1332 | | |
1333 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1334 | 1364 | | |
1335 | 1365 | | |
1336 | 1366 | | |
| |||
1668 | 1698 | | |
1669 | 1699 | | |
1670 | 1700 | | |
1671 | | - | |
1672 | | - | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
1686 | | - | |
1687 | 1701 | | |
1688 | 1702 | | |
1689 | 1703 | | |
| |||
1702 | 1716 | | |
1703 | 1717 | | |
1704 | 1718 | | |
1705 | | - | |
| 1719 | + | |
1706 | 1720 | | |
1707 | 1721 | | |
1708 | 1722 | | |
1709 | 1723 | | |
1710 | 1724 | | |
1711 | | - | |
| 1725 | + | |
1712 | 1726 | | |
1713 | 1727 | | |
1714 | 1728 | | |
| |||
1734 | 1748 | | |
1735 | 1749 | | |
1736 | 1750 | | |
1737 | | - | |
1738 | | - | |
| 1751 | + | |
| 1752 | + | |
1739 | 1753 | | |
1740 | 1754 | | |
1741 | 1755 | | |
1742 | 1756 | | |
1743 | 1757 | | |
1744 | 1758 | | |
1745 | 1759 | | |
1746 | | - | |
| 1760 | + | |
1747 | 1761 | | |
1748 | 1762 | | |
1749 | 1763 | | |
| |||
1755 | 1769 | | |
1756 | 1770 | | |
1757 | 1771 | | |
1758 | | - | |
| 1772 | + | |
1759 | 1773 | | |
1760 | 1774 | | |
1761 | 1775 | | |
| |||
1785 | 1799 | | |
1786 | 1800 | | |
1787 | 1801 | | |
1788 | | - | |
| 1802 | + | |
1789 | 1803 | | |
1790 | 1804 | | |
1791 | 1805 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
1774 | 1775 | | |
1775 | 1776 | | |
1776 | 1777 | | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
1780 | | - | |
1781 | | - | |
1782 | | - | |
1783 | | - | |
1784 | | - | |
1785 | | - | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1786 | 1822 | | |
1787 | 1823 | | |
1788 | 1824 | | |
| |||
1796 | 1832 | | |
1797 | 1833 | | |
1798 | 1834 | | |
1799 | | - | |
| 1835 | + | |
1800 | 1836 | | |
1801 | 1837 | | |
1802 | 1838 | | |
1803 | 1839 | | |
1804 | 1840 | | |
1805 | | - | |
| 1841 | + | |
1806 | 1842 | | |
1807 | 1843 | | |
1808 | | - | |
| 1844 | + | |
1809 | 1845 | | |
1810 | 1846 | | |
1811 | 1847 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments