I apologize in advance for any inaccurate use of terminology, failing to observe standards or just general ignorance. Please correct me as any guidance is really appreciated as it helps me learn.
So, thanks to a topic (http://forum.micropython.org/viewtopic.php?f=16&t=2854) some time ago where Roberthh sent me down the path of using TCP callbacks on esp8266 I was able to understand the code and found that support for UDP callbacks was fairly trivial.
Code: Select all
$ git diff extmod/modlwip.c
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 62699bd..b73d248 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -281,6 +281,7 @@ STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p,
socket->incoming.pbuf = p;
socket->peer_port = (mp_uint_t)port;
memcpy(&socket->peer, addr, sizeof(socket->peer));
+ exec_user_callback(socket);
}
}
The point of this post was that I wanted to contribute this back to the community. UDP callbacks are so wonderful that everyone should have them; I wanted UDP callbacks to decrease latency for NTP (with milli support), but I imagine this would be attractive to people looking to implement mDNS. I'm happy to post some code that demonstrates this as working, but what should I do in order to contribute this back to the community?