]> git.meshlink.io Git - meshlink/blobdiff - test/channels-udp.c
Add AIO send fds to the event loop if they would block.
[meshlink] / test / channels-udp.c
index 8071d467f6a5ca8d3bbf82858b59a4d6eecd5b8d..f4ddbe2b0f1efb3988022233b89195b028183915 100644 (file)
@@ -55,10 +55,10 @@ static void client_receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *chann
        // We expect always the same amount of data from the server.
        assert(mesh->priv);
        struct client *client = mesh->priv;
-       assert(len == 512 || len == 65536);
+       assert(len == 512 || len == 65535);
        client->received += len;
 
-       if(len == 65536) {
+       if(len == 65535) {
                client->got_large_packet = true;
        }
 }
@@ -100,7 +100,7 @@ static bool accept_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint
        return false;
 }
 
-int main() {
+int main(void) {
        meshlink_set_log_cb(NULL, MESHLINK_WARNING, log_cb);
 
        // Open four new meshlink instance, the server and three peers.
@@ -142,16 +142,15 @@ int main() {
 
        // Check that we can send up to 65535 bytes without errors
 
-       char large_data[65536] = "";
+       char large_data[65535] = "";
 
        for(int i = 0; i < 3; i++) {
-               assert(meshlink_channel_send(server, channels[i], large_data, sizeof(large_data) + 1) == -1);
                assert(meshlink_channel_send(server, channels[i], large_data, sizeof(large_data)) == sizeof(large_data));
        }
 
-       // Assert that packets larger than 64 kiB are not allowed
+       // Assert that any larger packets are not allowed
 
-       assert(meshlink_channel_send(server, channels[0], large_data, 65537) == -1);
+       assert(meshlink_channel_send(server, channels[0], large_data, 65536) == -1);
 
        // Stream packets from server to clients for 5 seconds at 40 Mbps (1 kB * 500 Hz)