pthread_mutex_unlock(&(mesh->outpacketqueue_mutex));
//notify event loop
-
+ signal_trigger(&(mesh->loop),&(mesh->datafromapp));
}
bool meshlink_send_from_queue (meshlink_handle_t *mesh,outpacketqueue_t* p) {
MESHLINK_ENOMEM, // Out of memory
MESHLINK_ENOENT, // Node is not known
} meshlink_errno_t;
+typedef struct outpacketqueue {
+ meshlink_node_t *destination;
+ const void *data;
+ unsigned int len;
+} outpacketqueue_t;
#ifndef MESHLINK_INTERNAL_H
*/
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);
+
/// Get a handle for a specific node.
/** This function returns a handle for the node with the given name.
*
event_loop_t loop;
listen_socket_t listen_socket[MAXSOCKETS];
int listen_sockets;
+ signal_t datafromapp;
struct node_t *self;
timeout_add(&mesh->loop, &mesh->pingtimer, timeout_handler, &mesh->pingtimer, &(struct timeval){mesh->pingtimeout, rand() % 100000});
timeout_add(&mesh->loop, &mesh->periodictimer, periodic_handler, &mesh->periodictimer, &(struct timeval){mesh->pingtimeout, rand() % 100000});
+ //Add signal handler
+ //mesh->datafromapp = {0};
+ signal_add(&(mesh->loop),&(mesh->datafromapp), meshlink_send_from_queue,NULL, SIGTERM);
+
if(!event_loop_run(&mesh->loop)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Error while waiting for input: %s", strerror(errno));
return 1;
timeout_t ev;
} outgoing_t;
-typedef struct outpacketqueue {
- meshlink_node_t *destination;
- const void *data;
- unsigned int len;
-} outpacketqueue_t;
extern int maxoutbufsize;
extern int addressfamily;