]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.c
Make AIO more useful for UDP-style channels.
[meshlink] / src / meshlink.c
index a5bf2c90ac3f6f33916d8eafceadb98a24f56ebd..35640eb91f6cb7871c514583cab3e6baaf1adcdc 100644 (file)
@@ -4115,6 +4115,14 @@ static void channel_poll(struct utcp_connection *connection, size_t len) {
                        todo = len;
                }
 
+               if(connection->flags == UTCP_UDP) {
+                       size_t pmtu = utcp_get_mtu(connection->utcp);
+
+                       if(todo > pmtu) {
+                               todo = pmtu;
+                       }
+               }
+
                if(aio->data) {
                        sent = utcp_send(connection, (char *)aio->data + aio->done, todo);
                } else {