update to new API

This commit is contained in:
lxsang 2020-09-13 01:46:11 +02:00
parent 63688c416f
commit a8979c48dc
7 changed files with 130 additions and 136 deletions

View File

@ -1,12 +1,13 @@
[Unit] [Unit]
Description=Antd Publisher Service Description=Antd Publisher Service
After=antd.target After=antd.service
[Service] [Service]
Type=simple Type=simple
User=root User=root
WorkingDirectory=/opt/www WorkingDirectory=/opt/www
ExecStart=/opt/www/bin/runnerd ExecStart=/opt/www/bin/runnerd
Restart=always
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

Binary file not shown.

View File

@ -8,6 +8,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <antd/list.h> #include <antd/list.h>
#include <antd/ini.h> #include <antd/ini.h>
#include <antd/utils.h>
#include "log.h" #include "log.h"
#define MODULE_NAME "runner" #define MODULE_NAME "runner"

Binary file not shown.

View File

@ -13,6 +13,7 @@
#include <antd/list.h> #include <antd/list.h>
#include <antd/bst.h> #include <antd/bst.h>
#include <antd/utils.h>
#include "../tunnel.h" #include "../tunnel.h"
@ -368,8 +369,6 @@ int main(int argc, char** argv)
// now read data // now read data
while(running) while(running)
{ {
timeout.tv_sec = 0;
timeout.tv_usec = 500;
FD_ZERO(&fd_in); FD_ZERO(&fd_in);
FD_SET(fd, &fd_in); FD_SET(fd, &fd_in);
maxfd = fd; maxfd = fd;
@ -388,7 +387,7 @@ int main(int argc, char** argv)
} }
list_free(&list); list_free(&list);
status = select(maxfd + 1, &fd_in, NULL, NULL, &timeout); status = select(maxfd + 1, &fd_in, NULL, NULL, NULL);
switch (status) switch (status)
{ {
@ -397,9 +396,6 @@ int main(int argc, char** argv)
running = 0; running = 0;
break; break;
case 0: case 0:
timeout.tv_sec = 0;
timeout.tv_usec = 10000; // 5 ms
select(0, NULL, NULL, NULL, &timeout);
break; break;
// we have data // we have data
default: default:

Binary file not shown.

View File

@ -8,9 +8,12 @@
#include <sys/select.h> #include <sys/select.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <antd/list.h> #include <antd/list.h>
#include <antd/bst.h> #include <antd/bst.h>
#include <antd/utils.h>
#include "../tunnel.h" #include "../tunnel.h"
@ -20,7 +23,8 @@ static bst_node_t* clients = NULL;
static volatile int running = 1; static volatile int running = 1;
static void int_handler(int dummy) { static void int_handler(int dummy)
{
(void)dummy; (void)dummy;
running = 0; running = 0;
} }
@ -54,7 +58,6 @@ int main(int argc, char** argv)
tunnel_msg_t msg; tunnel_msg_t msg;
fd_set fd_in; fd_set fd_in;
int status, maxfd; int status, maxfd;
struct timeval timeout;
char buff[BUFFLEN + 1]; char buff[BUFFLEN + 1];
void *fargv[2]; void *fargv[2];
uint8_t *tmp; uint8_t *tmp;
@ -129,18 +132,15 @@ int main(int argc, char** argv)
running = 0; running = 0;
} }
// now read data // now read data
while (running) while (running)
{ {
timeout.tv_sec = 0;
timeout.tv_usec = 500;
FD_ZERO(&fd_in); FD_ZERO(&fd_in);
FD_SET(fd, &fd_in); FD_SET(fd, &fd_in);
FD_SET(fifo_fd, &fd_in); FD_SET(fifo_fd, &fd_in);
maxfd = fd > fifo_fd ? fd : fifo_fd; maxfd = fd > fifo_fd ? fd : fifo_fd;
status = select(maxfd + 1, &fd_in, NULL, NULL, &timeout); status = select(maxfd + 1, &fd_in, NULL, NULL, NULL);
switch (status) switch (status)
{ {
@ -149,9 +149,6 @@ int main(int argc, char** argv)
running = 0; running = 0;
break; break;
case 0: case 0:
timeout.tv_sec = 0;
timeout.tv_usec = 10000; // 5 ms
select(0, NULL, NULL, NULL, &timeout);
break; break;
// we have data // we have data
default: default:
@ -235,7 +232,6 @@ int main(int argc, char** argv)
bst_for_each(clients, send_data, fargv, 2); bst_for_each(clients, send_data, fargv, 2);
} }
} }
} }
} }
// unsubscribe all client // unsubscribe all client