完成管道后,插头连接会发生什么?

What happens to a plug connection after it finishes the pipeline?

我目前正在研究 Phoenix,我想知道插头连接完成其插头管道后会发生什么情况。

conn
|> endpoint
|> router
|> controller
|> view

文档说,render/3 函数将在视图中调用相应的模板函数,并使用状态代码 200 响应客户端。但是在这之后连接会发生什么? return 是否被任何更高级别的调用者(例如牛仔适配器)使用,或者管道是否只是以未使用的开放 return 结束?

source code for Plug.Conn.send_resp/1 at the time of writing, you can see that the connection is first sent through the adapter, but it's then returned. This is because there can be other plugs that can get a connection with state: :sent and do arbitrary stuff with it and the information it contains. The final return value (see here)最终是被适配器使用的