go-algorand
go-algorand copied to clipboard
P2P HTTP Implementation: open problems
There are a few open questions about p2p http risen in the p2p feature branch merge PR:
- If the ledgerService / catchpoint downloader grabs GetHTTPRequestConnection and grabs the underlying stream, does this mean it will break any other HTTP requests that are already using that stream (or might use it concurrently)? Just trying to understand what happens when you give away the underlying streams like this
Originally posted by @cce in https://github.com/algorand/go-algorand/pull/5939#discussion_r1657461379
- Maybe in a follow up PR we should get rid of StreamChainingHost and split by using a dedicated protocol for downloading ledger files or something? Just wondering whether it is possible with getStream() to end up with two HTTP requests trying to write/read from the same underlying stream at the same time?
Originally posted by @cce in https://github.com/algorand/go-algorand/pull/5939#discussion_r1657466374
- An idea for the future, maybe RegisterHTTPHandler sets up a separate protocol for each handler, rather than all sharing algorandP2pHTTPProtocol with our own gorrila mux router on top? Then I think it would be better able to support support concurrent HTTP requests for different handlers over different streams? Or maybe the libp2p http stuff already provides for multiple concurrent HTTP reqs? I was imagining they all share a single stream, but maybe that's not true.
Originally posted by @cce in https://github.com/algorand/go-algorand/pull/5939#discussion_r1657612730