Conversation
|
I was not able to get the |
|
@deadprogram looks like net.Listener is not working correctly. If I tap in directly to lneto's StackGo it works. Will use that instead |
|
Alright, not entirely happy with net.Listener failure, but that's something out of the scope of this PR |
|
Also we'd need to merge soypat/lneto#173 before merging this. If it works for you too throw in a good word for the PR so we can upgrade the httphi API! |
|
|
||
| func Listen(link *netlink.Esplink, port string) (net.Listener, error) { | ||
| // Listen by asking the lneto stack for a socket directly instead of going | ||
| // through stdlib net.Listen and the netdev file descriptor layer due to a bug. |
There was a problem hiding this comment.
It's as if Listen never opened the port in the stack so when a TCP packet arrives at port 80 (the one it supposedly opened and did not return an error) the stack sends an RST back, which is what it should do when no socket is registered on that port.
There was a problem hiding this comment.
When would this get worked on? Seems pretty important to me.
There was a problem hiding this comment.
Immediately after we merge this. My priority is upholding a solid example as we talked in the tinygo weekly. It can look pretty afterwards.
ComparisonBefore~10kB of allocations every time "On" button clicked in webserver example. After~12B of allocations every time "On" button clicked in webserver example |
|
Flash and RAM savings are apparent too. this is the apwebserver example |
|
I think this PR has more than I understood from the conversations. I expected it would add Perhaps moving the examples into 3 subdirs:
Then in the README, can mention these options for usage with the benefits and drawbacks, and encouraging use of httphi without just removing nethttp entirely would be a more prudent and less disruptive change. There are some other things that we might want to look at as well. router.Configure(httphi.RouterConfig{
FixedNumGoroutines: 4,
RequestHeaderBufferSize: 1024, // Google chrome requests are around 700 bytes in header size.
ResponseHeaderMinBufferSize: 128, // We won't be writing too much to headers. Unused request memory is reused on top of this.
RequestNumHeaderKVCap: 16, // Max number of headers we can expect.
Mux: &mux,
}This appears very frequently in the example, would be great to have something like |
|
Do keep in mind what you are asking for does not exist! there is no such thing as a That said, I do completely agree the current configuration phase is not pretty and looks very boilerplatey. I'll give it my best and sit down and look at the API real hard and see what we can do. As for Keep in mind |
|
net/http example added to front page and user note to accompany. Also worked in very neat (albeit breaking) changes to httphi which really improve the aesthetics of the examples I feel. Check it out! @deadprogram |
So I saw an opportunity to ditch net/http entirely (Except client case) which seems like a huge win especially when the resulting HTTP handling reads better in most cases (except form parsing, though more explicit on what is happening). Check it out!
I do keep net dependency for net.Listener though- it is a very nice abstraction.