Update to latest tower and tower-grpc

Signed-off-by: Sean McArthur <sean@buoyant.io>
This commit is contained in:
Sean McArthur 2018-12-19 12:32:09 -08:00 committed by Sean McArthur
parent efe5299575
commit 5b00bcf40e
9 changed files with 107 additions and 100 deletions

View File

@ -303,7 +303,7 @@ dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -330,7 +330,7 @@ dependencies = [
[[package]]
name = "http"
version = "0.1.13"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -352,7 +352,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -374,10 +374,10 @@ name = "hyper-balance"
version = "0.1.0"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-balance 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
@ -509,7 +509,7 @@ version = "0.1.0"
dependencies = [
"deflate 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -531,7 +531,7 @@ dependencies = [
"futures-mpsc-lossy 0.1.0",
"futures-watch 0.1.0 (git+https://github.com/carllerche/better-future)",
"h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-balance 0.1.0",
@ -542,7 +542,7 @@ dependencies = [
"linkerd2-fs-watch 0.1.0",
"linkerd2-metrics 0.1.0",
"linkerd2-never 0.1.0",
"linkerd2-proxy-api 0.1.4 (git+https://github.com/linkerd/linkerd2-proxy-api?tag=v0.1.4)",
"linkerd2-proxy-api 0.1.4 (git+https://github.com/linkerd/linkerd2-proxy-api?rev=1ad7018)",
"linkerd2-router 0.1.0",
"linkerd2-stack 0.1.0",
"linkerd2-task 0.1.0",
@ -571,7 +571,7 @@ dependencies = [
"tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)",
"tower-in-flight-limit 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-reconnect 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
"tower-util 0.1.0 (git+https://github.com/tower-rs/tower)",
"trust-dns-resolver 0.10.0 (git+https://github.com/bluejekyll/trust-dns?rev=c017c114)",
"try-lock 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -582,19 +582,18 @@ dependencies = [
[[package]]
name = "linkerd2-proxy-api"
version = "0.1.4"
source = "git+https://github.com/linkerd/linkerd2-proxy-api?tag=v0.1.4#bb4861389d504dfea7b616df8cf6329b1c6f5e50"
source = "git+https://github.com/linkerd/linkerd2-proxy-api?rev=1ad7018#1ad70188f9a6d94e2865413713a50390456fa6b6"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"prost 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quickcheck 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-grpc 0.1.0 (git+https://github.com/tower-rs/tower-grpc)",
"tower-grpc-build 0.1.0 (git+https://github.com/tower-rs/tower-grpc)",
"tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2)",
]
[[package]]
@ -604,7 +603,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"linkerd2-stack 0.1.0",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
@ -617,7 +616,7 @@ dependencies = [
"linkerd2-task 0.1.0",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
@ -637,7 +636,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-connect 0.1.0 (git+https://github.com/carllerche/tokio-connect)",
"tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
@ -1317,117 +1316,115 @@ version = "0.1.0"
source = "git+https://github.com/tower-rs/tower-http#3599ce02f063cf7db5aae3edcdaeb9073a7ebc33"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-balance"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-direct-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-discover 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-buffer"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-direct-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-direct-service"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-discover"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-grpc"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower-grpc#40b059abac9ca07edac252f4d0b69c55f6ecf88d"
source = "git+https://github.com/tower-rs/tower-grpc#a5959c924209bce0c41ffe6238db0707435cf099"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"prost 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2)",
"tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
"tower-util 0.1.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-grpc-build"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower-grpc#40b059abac9ca07edac252f4d0b69c55f6ecf88d"
source = "git+https://github.com/tower-rs/tower-grpc#a5959c924209bce0c41ffe6238db0707435cf099"
dependencies = [
"codegen 0.1.0 (git+https://github.com/carllerche/codegen)",
"heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-h2"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower-h2#9b96d8d5eabe56a44a7d01228b14e96d875e84b3"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-connect 0.1.0 (git+https://github.com/carllerche/tokio-connect)",
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-http"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower-http#3599ce02f063cf7db5aae3edcdaeb9073a7ebc33"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-add-origin 0.1.0 (git+https://github.com/tower-rs/tower-http)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-in-flight-limit"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-reconnect"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
"tower-util 0.1.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
name = "tower-service"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
version = "0.2.0"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1435,10 +1432,11 @@ dependencies = [
[[package]]
name = "tower-util"
version = "0.1.0"
source = "git+https://github.com/tower-rs/tower#f21e3e4df07a3c474f6873b5e02a90e3e574ef46"
source = "git+https://github.com/tower-rs/tower#075ffb372556d05a7db02ce49db34cfb22850dba"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-direct-service 0.1.0 (git+https://github.com/tower-rs/tower)",
"tower-service 0.2.0 (git+https://github.com/tower-rs/tower)",
]
[[package]]
@ -1689,7 +1687,7 @@ dependencies = [
"checksum h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1ac030ae20dee464c5d0f36544d8b914a6bc606da44a57e052d2b0f5dae129e0"
"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82"
"checksum hostname 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "58fab6e177434b0bb4cd344a4dabaa5bd6d7a8d792b1885aebcae7af1091d1cb"
"checksum http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "24f58e8c2d8e886055c3ead7b28793e1455270b5fb39650984c224bc538ba581"
"checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab"
"checksum httparse 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7b6288d7db100340ca12873fd4d08ad1b8f206a9457798dfb17c018a33fee540"
"checksum hyper 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5a4149341a6362e4d5c23a7cd96a3e964645642919b14c23b9102462a1ac685f"
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
@ -1706,7 +1704,7 @@ dependencies = [
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939"
"checksum linkerd2-proxy-api 0.1.4 (git+https://github.com/linkerd/linkerd2-proxy-api?tag=v0.1.4)" = "<none>"
"checksum linkerd2-proxy-api 0.1.4 (git+https://github.com/linkerd/linkerd2-proxy-api?rev=1ad7018)" = "<none>"
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
"checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
@ -1785,14 +1783,14 @@ dependencies = [
"checksum tower-add-origin 0.1.0 (git+https://github.com/tower-rs/tower-http)" = "<none>"
"checksum tower-balance 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-buffer 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-direct-service 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-discover 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-grpc 0.1.0 (git+https://github.com/tower-rs/tower-grpc)" = "<none>"
"checksum tower-grpc-build 0.1.0 (git+https://github.com/tower-rs/tower-grpc)" = "<none>"
"checksum tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2)" = "<none>"
"checksum tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)" = "<none>"
"checksum tower-in-flight-limit 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-reconnect 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-service 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-service 0.2.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum tower-util 0.1.0 (git+https://github.com/tower-rs/tower)" = "<none>"
"checksum trust-dns-proto 0.5.0 (git+https://github.com/bluejekyll/trust-dns?rev=c017c114)" = "<none>"
"checksum trust-dns-resolver 0.10.0 (git+https://github.com/bluejekyll/trust-dns?rev=c017c114)" = "<none>"

View File

@ -33,7 +33,7 @@ linkerd2-stack = { path = "lib/stack" }
linkerd2-task = { path = "lib/task" }
linkerd2-timeout = { path = "lib/timeout" }
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.4", version = "0.1.4" }
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "1ad7018", version = "0.1.4" }
bytes = "0.4"
env_logger = { version = "0.5", default-features = false }
@ -90,7 +90,7 @@ net2 = "0.2"
quickcheck = { version = "0.6", default-features = false }
linkerd2-metrics = { path = "./lib/metrics", features = ["test_util"] }
linkerd2-task = { path = "lib/task", features = ["test_util"] }
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.4", version = "0.1.4", features = ["arbitrary"] }
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "1ad7018", version = "0.1.4", features = ["arbitrary"] }
flate2 = { version = "1.0.1", default-features = false, features = ["rust_backend"] }
# `tokio-io` is needed for TCP tests, because `tokio::io` doesn't re-export
# the `read` function.

View File

@ -46,11 +46,12 @@ impl Addr {
a: &http::uri::Authority,
default_port: u16,
) -> Result<Self, Error> {
Self::from_str_and_port(a.host(), a.port().unwrap_or(default_port))
Self::from_str_and_port(a.host(), a.port_part().map(|p| p.as_u16()).unwrap_or(default_port))
}
pub fn from_authority_with_port(a: &http::uri::Authority) -> Result<Self, Error> {
a.port()
a.port_part()
.map(|p| p.as_u16())
.ok_or(Error::MissingPort)
.and_then(|p| Self::from_str_and_port(a.host(), p))
}
@ -145,11 +146,12 @@ impl NameAddr {
a: &http::uri::Authority,
default_port: u16,
) -> Result<Self, Error> {
Self::from_str_and_port(a.host(), a.port().unwrap_or(default_port))
Self::from_str_and_port(a.host(), a.port_part().map(|p| p.as_u16()).unwrap_or(default_port))
}
pub fn from_authority_with_port(a: &http::uri::Authority) -> Result<Self, Error> {
a.port()
a.port_part()
.map(|p| p.as_u16())
.ok_or(Error::MissingPort)
.and_then(|p| Self::from_str_and_port(a.host(), p))
}

View File

@ -249,7 +249,7 @@ where
.push(svc::watch::layer(tls_client_config.clone()))
.push(phantom_data::layer())
.push(control::add_origin::layer())
.push(buffer::layer())
.push(buffer::layer(config.destination_concurrency_limit))
.push(limit::layer(config.destination_concurrency_limit));
// Because the control client is buffered, we need to be able to
@ -323,7 +323,7 @@ where
// 4. Routes requests to the correct client (based on the
// request version and headers).
let endpoint_stack = client_stack
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(settings::router::layer::<Endpoint, _>())
.push(orig_proto_upgrade::layer())
.push(tap_layer.clone())
@ -353,7 +353,7 @@ where
let dst_stack = endpoint_stack
.push(resolve::layer(Resolve::new(resolver)))
.push(balance::layer())
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(profiles::router::layer(
profile_suffixes,
profiles_client,
@ -371,7 +371,7 @@ where
// But for now it's more important to use the request router's
// caching logic.
let dst_router = dst_stack
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(router::layer(|req: &http::Request<_>| {
let addr = req.extensions().get::<DstAddr>().cloned();
debug!("outbound dst={:?}", addr);
@ -405,7 +405,7 @@ where
// 4. Finally, if the Source had an SO_ORIGINAL_DST, this TCP
// address is used.
let addr_router = addr_stack
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(timeout::layer(config.bind_timeout))
.push(limit::layer(MAX_IN_FLIGHT))
.push(router::layer(|req: &http::Request<_>| {
@ -474,14 +474,14 @@ where
// If there is no `SO_ORIGINAL_DST` for an inbound socket,
// `default_fwd_addr` may be used.
let endpoint_router = client_stack
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(settings::router::layer::<Endpoint, _>())
.push(phantom_data::layer())
.push(tap_layer)
.push(http_metrics::layer::<_, classify::Response>(
endpoint_http_metrics,
))
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(router::layer(RecognizeEndpoint::new(default_fwd_addr)))
.make(&router::Config::new("in endpoint", capacity, max_idle_age))
.map(shared::stack)
@ -509,7 +509,7 @@ where
let dst_stack = endpoint_router
.push(phantom_data::layer())
.push(insert_target::layer())
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(profiles::router::layer(
profile_suffixes,
profiles_client,
@ -532,7 +532,7 @@ where
// 5. Finally, if the Source had an SO_ORIGINAL_DST, this TCP
// address is used.
let dst_router = dst_stack
.push(buffer::layer())
.push(buffer::layer(MAX_IN_FLIGHT))
.push(limit::layer(MAX_IN_FLIGHT))
.push(router::layer(|req: &http::Request<_>| {
let canonical = req

View File

@ -1,5 +1,4 @@
use futures::{Future, Poll, Stream};
use http::HeaderMap;
use prost::Message;
use std::{
fmt,
@ -72,15 +71,13 @@ where
// Coerces the stream's Error<()> to an Error<S::Error>.
fn coerce_stream_err(e: grpc::Error<()>) -> grpc::Error<S::Error> {
match e {
grpc::Error::Grpc(s, h) => grpc::Error::Grpc(s, h),
grpc::Error::Decode(e) => grpc::Error::Decode(e),
grpc::Error::Protocol(e) => grpc::Error::Protocol(e),
grpc::Error::Grpc(s) => grpc::Error::Grpc(s),
grpc::Error::Inner(()) => {
// `stream.poll` shouldn't return this variant. If it for
// some reason does, we report this as an unknown error.
warn!("unexpected gRPC stream error");
debug_assert!(false);
grpc::Error::Grpc(grpc::Status::with_code(grpc::Code::Unknown), HeaderMap::new())
grpc::Error::Grpc(grpc::Status::with_code(grpc::Code::Unknown))
}
}
}

View File

@ -9,11 +9,15 @@ use svc;
/// Wraps `Service` stacks with a `Buffer`.
#[derive(Debug)]
pub struct Layer<Req>(PhantomData<fn(Req)>);
pub struct Layer<Req> {
capacity: usize,
_marker: PhantomData<fn(Req)>,
}
/// Produces `Service`s wrapped with a `Buffer`
#[derive(Debug)]
pub struct Stack<M, Req> {
capacity: usize,
inner: M,
_marker: PhantomData<fn(Req)>,
}
@ -25,13 +29,19 @@ pub enum Error<M, S> {
// === impl Layer ===
pub fn layer<Req>() -> Layer<Req> {
Layer(PhantomData)
pub fn layer<Req>(capacity: usize) -> Layer<Req> {
Layer {
capacity,
_marker: PhantomData,
}
}
impl<Req> Clone for Layer<Req> {
fn clone(&self) -> Self {
Layer(PhantomData)
Layer {
capacity: self.capacity,
_marker: PhantomData,
}
}
}
@ -49,6 +59,7 @@ where
fn bind(&self, inner: M) -> Self::Stack {
Stack {
capacity: self.capacity,
inner,
_marker: PhantomData,
}
@ -60,6 +71,7 @@ where
impl<M: Clone, Req> Clone for Stack<M, Req> {
fn clone(&self) -> Self {
Stack {
capacity: self.capacity,
inner: self.inner.clone(),
_marker: PhantomData,
}
@ -80,7 +92,7 @@ where
fn make(&self, target: &T) -> Result<Self::Value, Self::Error> {
let inner = self.inner.make(&target).map_err(Error::Stack)?;
let executor = logging::context_executor(target.clone());
Buffer::new(inner, &executor).map_err(Error::Spawn)
Buffer::with_executor(inner, self.capacity, &executor).map_err(Error::Spawn)
}
}

View File

@ -1,7 +1,9 @@
pub extern crate linkerd2_stack as stack;
extern crate tower_service;
extern crate tower_util;
pub use self::tower_service::{MakeService, Service};
pub use self::tower_service::Service;
pub use self::tower_util::MakeService;
pub use self::stack::{
shared,

View File

@ -1,7 +1,6 @@
use bytes::Buf;
use futures::sync::{mpsc, oneshot};
use futures::{future, Async, Future, Poll, Stream};
use http::HeaderMap;
use hyper::body::Payload;
use never::Never;
use std::sync::atomic::{AtomicUsize, Ordering};
@ -110,11 +109,9 @@ impl<T: iface::Subscribe<Tap>> Server<T> {
Self { base_id, subscribe }
}
fn invalid_arg(event: http::header::HeaderValue) -> grpc::Error {
let status = grpc::Status::with_code(grpc::Code::InvalidArgument);
let mut headers = HeaderMap::new();
headers.insert("grpc-message", event);
grpc::Error::Grpc(status, headers)
fn invalid_arg(message: String) -> grpc::Error {
let status = grpc::Status::with_code_and_message(grpc::Code::InvalidArgument, message);
grpc::Error::Grpc(status)
}
}
@ -133,8 +130,8 @@ where
let limit = req.limit as usize;
if limit == 0 {
let v = http::header::HeaderValue::from_static("limit must be positive");
return future::Either::A(future::err(Self::invalid_arg(v)));
let err = Self::invalid_arg("limit must be positive".into());
return future::Either::A(future::err(err));
};
trace!("tap: limit={}", limit);
@ -147,10 +144,8 @@ where
Ok(m) => Arc::new(m),
Err(e) => {
warn!("invalid tap request: {} ", e);
let v = format!("{}", e)
.parse()
.unwrap_or_else(|_| http::header::HeaderValue::from_static("invalid message"));
return future::Either::A(future::err(Self::invalid_arg(v)));
let err = Self::invalid_arg(e.to_string());
return future::Either::A(future::err(err));
}
};
@ -213,10 +208,11 @@ impl<F: Future<Item = ()>> Future for ResponseFuture<F> {
Ok(Async::NotReady) => return Ok(Async::NotReady),
Ok(Async::Ready(())) => {}
Err(_) => {
let status = grpc::Status::with_code(grpc::Code::ResourceExhausted);
let mut headers = HeaderMap::new();
headers.insert("grpc-message", "Too many active taps".parse().unwrap());
return Err(grpc::Error::Grpc(status, headers));
let status = grpc::Status::with_code_and_message(
grpc::Code::ResourceExhausted,
"Too many active taps".into(),
);
return Err(grpc::Error::Grpc(status));
}
}

View File

@ -100,7 +100,7 @@ impl Controller {
}
fn grpc_internal_code() -> grpc::Error {
grpc::Error::Grpc(grpc::Status::with_code(grpc::Code::Internal), HeaderMap::new())
grpc::Error::Grpc(grpc::Status::with_code(grpc::Code::Internal))
}
impl Stream for DstReceiver {