]> git.meshlink.io Git - meshlink/blobdiff - src/net_packet.c
Use a separate event structure to handle meta data writes.
[meshlink] / src / net_packet.c
index 105cafbb21e3d2b90368fa739de5a1aafff95d8e..bb81081d25fafc3089beb320da9d44da2e6b4947 100644 (file)
@@ -36,7 +36,7 @@
 #include "connection.h"
 #include "device.h"
 #include "ethernet.h"
-#include "event.h"
+#include "tevent.h"
 #include "graph.h"
 #include "list.h"
 #include "logger.h"
@@ -96,11 +96,11 @@ void send_mtu_probe(node_t *n)
                send_udppacket(n, &packet);
        }
 
-       n->mtuevent = new_event();
+       n->mtuevent = new_tevent();
        n->mtuevent->handler = (event_handler_t)send_mtu_probe;
        n->mtuevent->data = n;
        n->mtuevent->time = now + 1;
-       event_add(n->mtuevent);
+       tevent_add(n->mtuevent);
 }
 
 void mtu_probe_h(node_t *n, vpn_packet_t *packet) {
@@ -484,7 +484,7 @@ void flush_queue(node_t *n)
        }
 }
 
-void handle_incoming_vpn_data(int sock)
+void handle_incoming_vpn_data(int sock, short events, void *data)
 {
        vpn_packet_t pkt;
        char *hostname;
@@ -515,3 +515,11 @@ void handle_incoming_vpn_data(int sock)
 
        receive_udppacket(n, &pkt);
 }
+
+void handle_device_data(int sock, short events, void *data)
+{
+       vpn_packet_t packet;
+
+       if(read_packet(&packet))
+               route(myself, &packet);
+}