]> git.meshlink.io Git - meshlink/blobdiff - src/meta.c
Stop using global variable mesh in net_packet.c.
[meshlink] / src / meta.c
index 645954965550c601e098f18185c191617aaef540..42e947101657871df945eded603c039f2b3d29af 100644 (file)
@@ -19,9 +19,9 @@
 
 #include "system.h"
 
-#include "cipher.h"
 #include "connection.h"
 #include "logger.h"
+#include "meshlink_internal.h"
 #include "meta.h"
 #include "net.h"
 #include "protocol.h"
@@ -37,7 +37,7 @@ bool send_meta_sptps(void *handle, uint8_t type, const char *buffer, size_t leng
        }
 
        buffer_add(&c->outbuf, buffer, length);
-       io_set(&c->io, IO_READ | IO_WRITE);
+       io_set(&mesh->loop, &c->io, IO_READ | IO_WRITE);
 
        return true;
 }
@@ -53,7 +53,7 @@ bool send_meta(connection_t *c, const char *buffer, int length) {
 
        if(c->allow_request == ID) {
                buffer_add(&c->outbuf, buffer, length);
-               io_set(&c->io, IO_READ | IO_WRITE);
+               io_set(&mesh->loop, &c->io, IO_READ | IO_WRITE);
                return true;
        }
 
@@ -61,7 +61,7 @@ bool send_meta(connection_t *c, const char *buffer, int length) {
 }
 
 void broadcast_meta(connection_t *from, const char *buffer, int length) {
-       for list_each(connection_t, c, connection_list)
+       for list_each(connection_t, c, mesh->connections)
                if(c != from && c->status.active)
                        send_meta(c, buffer, length);
 }
@@ -89,7 +89,7 @@ bool receive_meta_sptps(void *handle, uint8_t type, const char *data, uint16_t l
        if(c->tcplen) {
                if(length != c->tcplen)
                        return false;
-               receive_tcppacket(c, data, length);
+               receive_tcppacket(mesh, c, data, length);
                c->tcplen = 0;
                return true;
        }