-
共通
- Executorというtraitをimplする型が,tokioのtaskをspawnする責務を担っている(よってhyperはtokio runtimeでないと動かない)。ただしExecutorはtraitになっているので、実装の差し替えが考慮されている?(外部からcustom executorを差し込めるかは不明)
- なんかそれっぽいissueはある(hyperium/hyper#1854)
- Executor traitはtokio_executorのものなのでtokioからは逃れられないのだ...
- wakerどっかで呼んでるはずだけどどこ?
- Executorというtraitをimplする型が,tokioのtaskをspawnする責務を担っている(よってhyperはtokio runtimeでないと動かない)。ただしExecutorはtraitになっているので、実装の差し替えが考慮されている?(外部からcustom executorを差し込めるかは不明)
-
hyper serverメモ
-
Serverは内部的にspawn_allというものを格納したServer構造体を返している(https://github.com/hyperium/hyper/blob/master/src/server/mod.rs)
-
ServerはFutureをimplしており、これをtokioに渡すと非同期サーバーが立ち上がる。pollではspawn_allに対してpoll_watchを実行している
-
poll_watch内部でpoll_next_を読んでいる。ここでリクエストの受け入れを行なっている? https://github.com/hyperium/hyper/blob/master/src/server/conn.rs#L659 (imcoming(Accept traitを要求).poll_acceptを実行しているので)
-
Accept trait https://github.com/hyperium/hyper/blob/master/src/server/accept.rs#L18
-
Serveでpoll_next_を実行し,Connecting構造体を返している
-
NewSvcTask https://github.com/hyperium/hyper/blob/master/src/server/conn.rs#L852 (Futureをimplしている)
-
poll_watchでSpwanAll内部のServeのpoll_next_を実行。poll_next_内部でpoll_acceptを実行。Connecting structが返ってくる。poll_watchでserveのpoll_next_から返ってきたconnecting構造体をNewSvcTask::newに渡して、serveのexec(HTTP構造体)経由execute_new_svcを実行。
-
execute_new_svc内部でtokio::task::spawnを実行している。 https://github.com/hyperium/hyper/blob/master/src/common/exec.rs
-
-
hyper client メモ
- get requestの場合
- get requestの場合
Created
December 9, 2019 04:36
-
-
Save tawashichan/9dc95a6d79ff2fd22db1a41106fc1a31 to your computer and use it in GitHub Desktop.
hyper_memo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment