-
Notifications
You must be signed in to change notification settings - Fork 2k
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
lwip: provide sock_async support #13427
Conversation
@@ -98,7 +98,7 @@ void sock_tcp_queue_event_init(sock_tcp_queue_t *queue, | |||
event_queue_t *ev_queue, | |||
sock_tcp_queue_cb_t handler) | |||
{ | |||
sock_async_ctx_t *ctx = sock_tcp_queue_get_async_ctx(sock); | |||
sock_async_ctx_t *ctx = sock_tcp_queue_get_async_ctx(queue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this bug while trying to integrate sock_async
with sock_tcp
. Hope nobody minds I piggy-back this bug fix here. It is in a separate commit, so I can always factor it out if not.
I changed the patch to be a cherry-pick of a feature that was introduced in lwIP's current master. See https://savannah.nongnu.org/patch/?9891#comment1 |
5aaf4d0
to
386c3f1
Compare
I have tested it with |
I came around implementing it for TCP after all. Tests should now also work for TCP. In a later step I might even rework the tests a bit to reflect their new asynchronous nature better (e.g. by providing a way to stop the running server, provide support for more than one connection with TCP... etc) |
Behavior for TCP has changed with this PR. After sending something with
In master, I had to leave
|
Mhhh curious. For me the behavior (with native) was as you described for the |
I'm using the official Ubuntu 18.04 netcat version 1.187. The command I used:
With
In master, I can observe:
|
Can you please revert the test change (53e6a81 currently) and try again? I'm trying to figure out if this happens due to my changes to the test or |
Ok, I was able to reproduce it now. Trying to find a fix. |
24ce2ba
to
0530e9d
Compare
Rebased to current master to incorporate #13438. Trying to fix the faulty behavior mentioned in #13438 (comment) now. |
It turned out to be an error in the
|
I also added a regression test for this bug now... If you want I can also move the bug fix to a separate PR. Not sure how easy it is to reproduce without |
try: | ||
connect_addr = socket.getaddrinfo( | ||
"%s%%tapbr0" % server_ip, port)[0][4] | ||
except socket.gaierror as e: | ||
print("SKIP_TEST INFO", e) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests need to be adapted for riotnode
(#10949) once that is merged anyway, so I hope you don't mind tapbr0
being statically used here (and expect the boards to be native
for the test not to be skipped above) and the test being skipped instead as a short workaround. Otherwise I would need a third "board" just for this test.
Preliminary testing with gcoap works on an ESP8266. See my gcoap/lwip_async_support branch, which includes IPv4 support.
The down side is that the gcoap thread uses 1596 bytes for IPv4 and 1652 for IPv6 on ESP8266, according to |
Unless I missed something, the stack size is derived from the default stack size as defined by the CPU, which is already 1024 bytes: #define GCOAP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE \
+ sizeof(coap_pkt_t) The question is how much stack is really needed. Maybe the stack size could be fine tuned a little bit for gcoap. Have you checked with |
Thanks for the feedback. The numbers I quoted above are actual stack usage with |
No, that's fine with me. |
Works now as expected. |
Ping @gschorcht @kb2ma? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I lost track of that PR. Looks good and works as expected. ACK
@miri64 Please squash. |
Prevents unnecessary usage of resources, as the queue of `sock_tcp` is restricted.
6eaa2c7
to
37df4ea
Compare
Squashed |
@miri64 Many thanks for this contribution. |
Thanks for the review! :-) |
Contribution description
This provides initial
sock_async
support for lwIP.Currently only(edit: was a bit tricky but not that hard after all ;-)) The change requires an update to upstream, which I provided in this PR as a patch.sock_udp
andsock_ip
are supported,sock_tcp
needs some extra work, I don't have the time for right now.Testing procedure
I updated
tests/lwip
to usesock_async_event
for theudp server
andip server
[edit: and thetcp server
] command, so runningmake -C tests/lwip all test
onnative
should still work.Issues/PRs references
None.