Open igorcafe opened 8 months ago
Could you link to the implementation of NewContextReader that you are using? I'm guessing there that Read is directed to ReadContext instead. I'm not sure it's possible to do any better than that. I'm sure I have an implementation of that somewhere, but I'm on my mobile.
For wrapping torrents in HTTP, check out anacrolix/confluence and anacrolix/webtorrent-public. Both are used in very mature projects that do streaming BitTorrent over HTTP.
I'm building a server that streams torrents through HTTP. I just found out that we had the same idea of creating a "ContextReader", but I saw that here you pass a fixed
context.Background()
, so there is no way for me to pass a context and cancel it.What I ended up doing was:
Where the context is the
http.Request.Context()
,src
is thetorrent.Reader
anddst
is thehttp.ResponseWriter
.