From 73f3ec01f5819df17f3b6d10fda6cab9b688711e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 2 Jan 2023 01:20:40 +0100 Subject: removed non-ASCII bytes from JSON output --- src/main.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index f613e4e..e659e6b 100644 --- a/src/main.c +++ b/src/main.c @@ -48,24 +48,24 @@ int main (int argc, char ** argv) { error_at_line(3, errno, __FILE__, __LINE__, "sigaction(SIGTERM)"); if (sigaction(SIGUSR1, &sigact, NULL) == -1) error_at_line(4, errno, __FILE__, __LINE__, "sigaction(SIGUSR1)"); - struct itimerval itimerval = { - .it_interval = { - .tv_sec = 13*60 - } - }; - if (setitimer(ITIMER_REAL, &itimerval, NULL)) - error_at_line(5, errno, __FILE__, __LINE__, "setitimer"); sigset_t sigset; if (sigemptyset(&sigset) == -1) - error_at_line(6, errno, __FILE__, __LINE__, "sigemptyset"); + error_at_line(5, errno, __FILE__, __LINE__, "sigemptyset"); if (sigaddset(&sigset, SIGUSR1) == -1) - error_at_line(7, errno, __FILE__, __LINE__, "sigaddset(SIGUSR1)"); + error_at_line(6, errno, __FILE__, __LINE__, "sigaddset(SIGUSR1)"); if (sigaddset(&sigset, SIGALRM) == -1) - error_at_line(8, errno, __FILE__, __LINE__, "sigaddset(SIGALRM)"); + error_at_line(7, errno, __FILE__, __LINE__, "sigaddset(SIGALRM)"); if (sigprocmask(SIG_UNBLOCK, &sigset, NULL) == -1) - error_at_line(9, errno, __FILE__, __LINE__, "sigprocmask"); + error_at_line(8, errno, __FILE__, __LINE__, "sigprocmask"); + /* struct itimerval itimerval = { + .it_interval = { + .tv_sec = 60 + } + }; + if (setitimer(ITIMER_REAL, &itimerval, NULL) == -1) + error_at_line(9, errno, __FILE__, __LINE__, "setitimer"); */ if (argc != 1+1) - error_at_line(10, 0, __FILE__, __LINE__, "%s configfile.ben > possible_torrents.L", S0(argv[0])); + error_at_line(10, 0, __FILE__, __LINE__, "%s configfile.ben >> possible_torrents.L", S0(argv[0])); int cf = open(argv[1], O_RDWR | O_CLOEXEC | O_CREAT, 00664); if (cf == -1) error_at_line(11, errno, __FILE__, __LINE__, "open(%s)", argv[1]); @@ -89,12 +89,12 @@ int main (int argc, char ** argv) { memcpy(torrent->hash, "\xdd\x82\x55\xec\xdc\x7c\xa5\x5f\xb0\xbb\xf8\x13\x23\xd8\x70\x62\xdb\x1f\x6d\x1c", 20); torrent->type = announce | peers; add_torrent(dht, torrent); - work(dht); struct pollfd pollfd = { .fd = dht->socket, .events = POLLIN }; w: + alarm(13*60); while (poll(&pollfd, 1, -1) == 1) work(dht); if (errno == EINTR) { -- cgit v1.2.3