HTTP/2 server with futures/tokio



I’ve implemented HTTP/2 server in rust with tokio and futures as a part of gRPC implementation.

Code is buggy, incomplete and undocumented, so I’ve created a simplified pseudocode version of that implemenation: here.

Could someone please have a look at that pseudocode and tell me than I understand idea of futures/tokio properly. Or it can be simplified.

I’m unsure about following decisions:

  • a channel is created to send messages to write loop
  • a task is spawned for each HTTP/2 requst to drive a future of the request. Can I/should I use the connection task to execute handler future?
  • a channel is created for each HTTP/2 stream

cc @alexcrichton @carllerche