Skip to content
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

feat: Export Handlers (req, resp, https) #445

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

guilhem
Copy link

@guilhem guilhem commented Jul 15, 2021

This is usufull when handlers will be dynamicaly created and removed.

This is usufull when handlers will be dynamicaly created and removed.
@guilhem guilhem changed the title feat: Export Handlers (req, rest, https) feat: Export Handlers (req, resp, https) Jul 15, 2021
@elazarl
Copy link
Owner

elazarl commented Jul 16, 2021

Can you please explain why you can't use the existing methods to manipulate the handlers?

Making a private field public is risky, as it cannot be undone.

@guilhem
Copy link
Author

guilhem commented Jul 16, 2021

@elazarl in current implementation, Handlers are manipulated by .Do(, .HijackConnect(, .HandleConnect( and only with an = append(.
It makes impossible to remove elements or to know what are elements inside.

What I need is to Add / List and Remove handlers to be able to do it dynamically (at run-time).

@guilhem
Copy link
Author

guilhem commented Jul 27, 2021

This permit to update content without edgecases

Signed-off-by: Guilhem Lettron <[email protected]>
@elazarl
Copy link
Owner

elazarl commented Jan 31, 2022

I don't see why you need indirection. Making them public should be good enough.

Slice is already a pointer.

Also not sure how you handle concurrency.

@guilhem
Copy link
Author

guilhem commented Jan 31, 2022

I don't see why you need indirection. Making them public should be good enough.

Slice is already a pointer.

Also not sure how you handle concurrency.

I totally agree with you.
But I faced a lot of problems with slices and make it working with pointer. 🤷‍♂️
I need to do more tests.

I also find this article, not sure if applicable: https://medium.com/swlh/golang-tips-why-pointers-to-slices-are-useful-and-how-ignoring-them-can-lead-to-tricky-bugs-cac90f72e77b

@guilhem
Copy link
Author

guilhem commented Feb 8, 2022

@elazarl I did more tests and slice is not updated if it's not a pointer.
Having a pointer also have some interest, it's possible to update content atomically. Just create a new slice with right content and update pointer in 1 step.

@elazarl
Copy link
Owner

elazarl commented Feb 27, 2024

@guilhem what I suggest is, add a single handler that has internal handlers, and handle concurrency inside

We'll add this as an extension.

What do you think?

@guilhem
Copy link
Author

guilhem commented Mar 2, 2024

@guilhem what I suggest is, add a single handler that has internal handlers, and handle concurrency inside

We'll add this as an extension.

What do you think?

I will try to do this solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants