signal_trigger(&(mesh->loop),&(mesh->datafromapp));
}
-bool meshlink_send_from_queue (meshlink_handle_t *mesh,outpacketqueue_t* p) {
+bool meshlink_send_from_queue(meshlink_handle_t *mesh) {
vpn_packet_t packet;
meshlink_packethdr_t *hdr = (meshlink_packethdr_t *)packet.data;
+
+ outpacketqueue_t* p = list_get_tail(mesh->outpacketqueue);
+ if (p)
+ list_delete_tail(mesh->outpacketqueue);
+ else return false;
+
if (sizeof(meshlink_packethdr_t) + p->len > MAXSIZE) {
//log something
return false;
*/
extern bool meshlink_send(meshlink_handle_t *mesh, meshlink_node_t *destination, const void *data, unsigned int len);
-extern bool meshlink_send_from_queue (meshlink_handle_t *mesh,outpacketqueue_t* p);
+extern bool meshlink_send_from_queue (meshlink_handle_t *mesh);
/// Get a handle for a specific node.
/** This function returns a handle for the node with the given name.
//Add signal handler
mesh->datafromapp.signum = 0;
- signal_add(&(mesh->loop),&(mesh->datafromapp), meshlink_send_from_queue,NULL, mesh->datafromapp.signum);
+ signal_add(&(mesh->loop),&(mesh->datafromapp), meshlink_send_from_queue,mesh, mesh->datafromapp.signum);
if(!event_loop_run(&mesh->loop)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Error while waiting for input: %s", strerror(errno));