[[package]]
name = "bytes"
-version = "0.5.3"
+version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38"
-
-[[package]]
-name = "bytes"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72"
+checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
[[package]]
name = "c2-chacha"
[[package]]
name = "h2"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21"
-dependencies = [
- "bytes 1.0.0",
- "fnv",
- "futures-core",
- "futures-sink",
- "futures-util",
- "http 0.2.0",
- "indexmap 1.5.2",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
-[[package]]
-name = "h2"
-version = "0.4.0"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a"
+checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
- "http 1.0.0",
- "indexmap 2.0.0",
+ "http",
+ "indexmap",
"slab",
"tokio",
"tokio-util",
"tracing",
]
-[[package]]
-name = "hashbrown"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb"
-dependencies = [
- "autocfg 1.1.0",
-]
-
[[package]]
name = "hashbrown"
version = "0.14.0"
[[package]]
name = "hermit-abi"
-version = "0.3.2"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "hippotat"
"futures",
"heck",
"hippotat-macros",
- "http-body 1.0.1",
+ "http-body",
"http-body-util",
- "hyper 0.14.7",
+ "hyper",
+ "hyper-util",
"indenter",
"ipnet",
"itertools",
"memchr",
"mime",
"nix",
- "parking_lot",
+ "parking_lot 0.11.0",
"pin-project-lite",
"regex",
"reqwest",
"winapi",
]
-[[package]]
-name = "http"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
-dependencies = [
- "bytes 0.5.3",
- "fnv",
- "itoa 0.4.7",
-]
-
[[package]]
name = "http"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"fnv",
"itoa 1.0.0",
]
-[[package]]
-name = "http-body"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
-dependencies = [
- "bytes 1.0.0",
- "http 0.2.0",
-]
-
[[package]]
name = "http-body"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
- "bytes 1.0.0",
- "http 1.0.0",
+ "bytes",
+ "http",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"futures-util",
- "http 1.0.0",
- "http-body 1.0.1",
+ "http",
+ "http-body",
"pin-project-lite",
]
[[package]]
name = "hyper"
-version = "0.14.7"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e5f105c494081baa3bf9e200b279e27ec1623895cd504c7dbef8d0b080fcf54"
+checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"futures-channel",
- "futures-core",
"futures-util",
- "h2 0.3.18",
- "http 0.2.0",
- "http-body 0.4.0",
+ "h2",
+ "http",
+ "http-body",
"httparse",
"httpdate",
- "itoa 0.4.7",
- "pin-project",
- "socket2 0.4.10",
- "tokio",
- "tower-service",
- "tracing",
- "want",
-]
-
-[[package]]
-name = "hyper"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75"
-dependencies = [
- "bytes 1.0.0",
- "futures-channel",
- "futures-util",
- "h2 0.4.0",
- "http 1.0.0",
- "http-body 1.0.1",
- "httparse",
"itoa 1.0.0",
"pin-project-lite",
+ "smallvec",
"tokio",
"want",
]
checksum = "736f15a50e749d033164c56c09783b6102c4ff8da79ad77dbddbbaea0f8567f7"
dependencies = [
"futures-util",
- "http 1.0.0",
- "hyper 1.1.0",
+ "http",
+ "hyper",
"hyper-util",
"rustls",
"rustls-pki-types",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"http-body-util",
- "hyper 1.1.0",
+ "hyper",
"hyper-util",
"native-tls",
"tokio",
[[package]]
name = "hyper-util"
-version = "0.1.3"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
+checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"futures-channel",
"futures-util",
- "http 1.0.0",
- "http-body 1.0.1",
- "hyper 1.1.0",
+ "http",
+ "http-body",
+ "hyper",
"pin-project-lite",
- "socket2 0.5.0",
+ "socket2",
"tokio",
- "tower",
"tower-service",
"tracing",
]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0bd112d44d9d870a6819eb505d04dd92b5e4d94bb8c304924a0872ae7016fb5"
-[[package]]
-name = "indexmap"
-version = "1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e47a3566dd4fd4eec714ae6ceabdee0caec795be835c223d92c2d40f1e8cf1c"
-dependencies = [
- "autocfg 1.1.0",
- "hashbrown 0.8.1",
-]
-
[[package]]
name = "indexmap"
version = "2.0.0"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
- "hashbrown 0.14.0",
+ "hashbrown",
]
[[package]]
[[package]]
name = "libc"
-version = "0.2.156"
+version = "0.2.168"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a"
+checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
[[package]]
name = "linux-raw-sys"
[[package]]
name = "lock_api"
-version = "0.4.0"
+version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de302ce1fe7482db13738fbaf2e21cfb06a986b89c0bf38d88abf16681aada4e"
+checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
dependencies = [
"scopeguard",
]
[[package]]
name = "mio"
-version = "0.7.6"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b"
+checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
dependencies = [
+ "hermit-abi",
"libc",
- "log",
- "miow",
- "ntapi",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
-dependencies = [
- "socket2 0.3.16",
- "winapi",
+ "wasi",
+ "windows-sys 0.52.0",
]
[[package]]
"pin-utils",
]
-[[package]]
-name = "ntapi"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcdaac6150484ca8fed0f2ba30c2970d05da1ceac10d1beefae91ff4ada7928f"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "num_cpus"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "object"
version = "0.36.0"
dependencies = [
"instant",
"lock_api",
- "parking_lot_core",
+ "parking_lot_core 0.8.0",
+]
+
+[[package]]
+name = "parking_lot"
+version = "0.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
+dependencies = [
+ "lock_api",
+ "parking_lot_core 0.9.0",
]
[[package]]
"cloudabi 0.1.0",
"instant",
"libc",
- "redox_syscall",
+ "redox_syscall 0.1.56",
"smallvec",
"winapi",
]
[[package]]
-name = "percent-encoding"
-version = "2.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
-
-[[package]]
-name = "pin-project"
-version = "1.0.2"
+name = "parking_lot_core"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7"
+checksum = "b2f4f894f3865f6c0e02810fc597300f34dc2510f66400da262d8ae10e75767d"
dependencies = [
- "pin-project-internal",
+ "cfg-if 1.0.0",
+ "libc",
+ "redox_syscall 0.2.8",
+ "smallvec",
+ "windows-sys 0.29.0",
]
[[package]]
-name = "pin-project-internal"
-version = "1.0.2"
+name = "percent-encoding"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.103",
-]
+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pin-project-lite"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
+[[package]]
+name = "redox_syscall"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
+dependencies = [
+ "bitflags 1.2.1",
+]
+
[[package]]
name = "redox_termios"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc495930de8d330f14856cface52561b7d79a072c76e438cf8f34d7233a35fa7"
dependencies = [
- "redox_syscall",
+ "redox_syscall 0.1.56",
]
[[package]]
checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
dependencies = [
"base64 0.22.0",
- "bytes 1.0.0",
+ "bytes",
"encoding_rs",
"futures-core",
"futures-util",
- "h2 0.4.0",
- "http 1.0.0",
- "http-body 1.0.1",
+ "h2",
+ "http",
+ "http-body",
"http-body-util",
- "hyper 1.1.0",
+ "hyper",
"hyper-rustls",
"hyper-tls",
"hyper-util",
[[package]]
name = "smallvec"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
-
-[[package]]
-name = "socket2"
-version = "0.3.16"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fd8b795c389288baa5f355489c65e71fd48a02104600d15c4cfbc561e9e429d"
-dependencies = [
- "cfg-if 0.1.10",
- "libc",
- "redox_syscall",
- "winapi",
-]
+checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e"
[[package]]
name = "socket2"
-version = "0.4.10"
+version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
+checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
"libc",
- "winapi",
-]
-
-[[package]]
-name = "socket2"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f86942952dddcbda5e75d086eb38ae9e51d5bc0374299ff4596d836f036dbc36"
-dependencies = [
- "libc",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
]
[[package]]
"cfg-if 0.1.10",
"libc",
"rand",
- "redox_syscall",
+ "redox_syscall 0.1.56",
"remove_dir_all",
"winapi",
]
checksum = "8affd752d0f2c7127d6d5f1b98182a5471606b48b1a955165d39eb5e4887ceba"
dependencies = [
"libc",
- "redox_syscall",
+ "redox_syscall 0.1.56",
"redox_termios",
]
[[package]]
name = "tokio"
-version = "1.7.0"
+version = "1.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c79ba603c337335df6ba6dd6afc38c38a7d5e1b0c871678439ea973cd62a118e"
+checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
dependencies = [
- "autocfg 1.1.0",
- "bytes 1.0.0",
+ "backtrace",
+ "bytes",
"libc",
- "memchr",
"mio",
- "num_cpus",
- "once_cell",
- "parking_lot",
+ "parking_lot 0.12.0",
"pin-project-lite",
"signal-hook-registry",
+ "socket2",
"tokio-macros",
- "winapi",
+ "windows-sys 0.52.0",
]
[[package]]
name = "tokio-macros"
-version = "1.1.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57"
+checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.103",
+ "syn 2.0.52",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
dependencies = [
- "bytes 1.0.0",
+ "bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tracing",
]
-[[package]]
-name = "tower"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ebe6c299e025c20c08a730be54f816b90089d153a58b8648adea98eee85c82a"
-dependencies = [
- "futures-core",
- "futures-util",
- "pin-project",
- "tokio",
- "tower-layer",
- "tower-service",
- "tracing",
-]
-
-[[package]]
-name = "tower-layer"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62"
-
[[package]]
name = "tower-service"
version = "0.3.0"
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
dependencies = [
"cfg-if 1.0.0",
- "log",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
[[package]]
name = "winapi"
-version = "0.3.9"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-sys"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ceb069ac8b2117d36924190469735767f0990833935ab430155e71a44bafe148"
+dependencies = [
+ "windows_aarch64_msvc 0.29.0",
+ "windows_i686_gnu 0.29.0",
+ "windows_i686_msvc 0.29.0",
+ "windows_x86_64_gnu 0.29.0",
+ "windows_x86_64_msvc 0.29.0",
+]
+
[[package]]
name = "windows-sys"
version = "0.36.0"
"windows-targets 0.48.0",
]
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58"
+
[[package]]
name = "windows_i686_gnu"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4"
+
[[package]]
name = "windows_i686_msvc"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.0"
all_clients,
});
+ let max_buffer = chain!(
+ [16384], // hyper demands at least 8192
+ ics.iter().map(|ic| {
+ [ic.max_batch_up,
+ ic.max_batch_down]
+ }).flatten(),
+ ).max().expect("not empty since we have at least one [item]")
+ .try_into().unwrap_or_else(|_: TryFromIntError| usize::MAX);
+
for (ic, (web_recv, route_recv)) in izip!(
ics,
client_handles_recv,
let mut listeners = vec![];
for saddr in &global.config.addrs {
let saddr = SocketAddr::new(*saddr, global.config.port);
- // TODO move bind() here
- let listener = ();
+ let listener = tokio::net::TcpListener::bind(saddr)
+ .await
+ .with_context(|| format!("bind {}", saddr))?;
listeners.push((saddr, listener));
}
listeners
};
for (saddr, listener) in listeners {
- let make_service = hyper::service::make_service_fn({
- let global = global.clone();
- move |conn: &hyper::server::conn::AddrStream| {
- let caddr = conn.remote_addr();
- let global = global.clone();
- let caddr = Arc::new(format!("[{}]", caddr));
+ info!("listening on {}", &saddr);
+ let global = global.clone();
+
+ let task = tokio::task::spawn(async move {
+ loop {
+ let (conn, caddr) = match listener.accept().await {
+ Ok(y) => y,
+ Err(e) => { debug!("{saddr}: listen error: {e:#}"); continue; }
+ };
+ let caddr = Arc::new(format!("[{caddr}]"));
let service = hyper::service::service_fn({
+ let global = global.clone();
+ let caddr = caddr.clone();
move |req| {
let global = global.clone();
let caddr = caddr.clone();
}
}
});
- async { Ok::<_, Void>(service) }
- }
- });
- let () = listener; // TODO move bind() earlier.
- let server = hyper::Server::try_bind(&saddr)
- .context("bind")?
- .http1_preserve_header_case(true)
- .serve(make_service);
- info!("listening on {}", &saddr);
- let task = tokio::task::spawn(async move {
- match server.await {
- Ok(()) => anyhow!("shut down?!"),
- Err(e) => e.into(),
+ let conn = hyper_util::rt::tokio::TokioIo::new(conn);
+
+ let conn_fut = hyper::server::conn::http1::Builder::new()
+ .half_close(true)
+ .title_case_headers(true)
+ .max_buf_size(max_buffer)
+ .serve_connection(conn, service);
+
+ tokio::task::spawn(async move {
+ match conn_fut.await {
+ Ok(()) => {},
+ Err(e) => trace!("{}: client connection from {} failed: {:#}",
+ saddr, caddr, e),
+ };
+ });
}
});
tasks.push((task, format!("http server {}", saddr)));