summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c26
1 files changed, 13 insertions, 13 deletions
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) {