-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
middleware/hooks: preserve prehook response changes #566
base: main
Are you sure you want to change the base?
Conversation
Hey there! Yeah, this behavior is definitely up for discussion. What say you @mrd0ll4r? |
Hmm. This kind of disrespects What's the reasoning on your end to implement this as a prehook instead of a posthook, @shyba ? EDIT: Thinking about it some more, the most elegant approach would be to pass a (possibly non-empty) slice of |
Hi, sorry for the delay. I'm traveling for some days.
I tried using it as a posthook, but it looks like the posthook runs after
the response is sent on a thread? At least that is what I have on history
from last I tried. I will try again as soon as I'm back.
This is the code I saw that looks like running after the response is sent:
https://github.com/chihaya/chihaya/blob/7455c2ad4a5860d7f73b98cae4e4160e194fb45b/frontend/udp/frontend.go#L322
This is my middleware implementation:
https://github.com/shyba/chihaya/tree/main/middleware/fixedpeer
(The other changes on that branch are work in progress, but I plan on
upstreaming everything that makes sense when it is done. The one on ports
is related to "anonymous mode" where some torrent clients will send 0 or 1
as invalid port to query without announcing)
|
(replying via email via phone, also traveling, hope this works)Oh, right, that's how that worked.I guess this is fine then. Please also open an issue to change the storage interface to take a slice of peers as an input, for the future 😊On Apr 17, 2022 21:53, Victor Shyba ***@***.***> wrote:
Hi, sorry for the delay. I'm traveling for some days.
I tried using it as a posthook, but it looks like the posthook runs after
the response is sent on a thread? At least that is what I have on history
from last I tried. I will try again as soon as I'm back.
This is the code I saw that looks like running after the response is sent:
https://github.com/chihaya/chihaya/blob/7455c2ad4a5860d7f73b98cae4e4160e194fb45b/frontend/udp/frontend.go#L322
This is my middleware implementation:
https://github.com/shyba/chihaya/tree/main/middleware/fixedpeer
(The other changes on that branch are work in progress, but I plan on
upstreaming everything that makes sense when it is done. The one on ports
is related to "anonymous mode" where some torrent clients will send 0 or 1
as invalid port to query without announcing)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Opened issue #569, enjoy the trip! |
CI is borked, might be fixed via #567, let's wait for that to land. |
You should be able to rebase this and get the CI to work now :) |
349b07c
to
7d9731d
Compare
Sorry, just saw your message. Rebased, lets see :) |
pretty sure CI is borked again, but due to something else this time :D Sorry... Not your fault, we'll fix it eventually |
Hi, thanks for this amazing project.
While implementing a prehook middleware, my changes to IPv4Peers were being discarded. This is what I had to do in order to fix it.
(I don't know if it is expected for prehook middleware implementations to modify responses, so feel free to discard the PR as well. The middleware I am working on needs to inject peers and using this hook was the cleanest approach.)