From 75af3d9de2fd45cdc5ba1b6427bba725c56f4fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 12 Feb 2023 00:04:50 +0100 Subject: =?UTF-8?q?program=20in=20za=C4=8Detek=20analize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 4e9c188..de21f7a 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,7 @@ void found_torrent (struct dht * d __attribute__((unused)), const unsigned char L(debug, d, "%s%s", buf, t ? " stored" : " new"); if (t) { if (!t->type) - t->ttl = seconds()+128; + t->ttl = seconds()+256; t->type |= info | peers; } else { if (last_added + 1 > seconds()) { @@ -56,7 +56,7 @@ void found_torrent (struct dht * d __attribute__((unused)), const unsigned char t = torrent_init(); memcpy(t->hash, h, 20); t->type |= info | peers; - t->ttl = seconds()+128; + t->ttl = seconds()+256; add_torrent(d, t); } } @@ -135,6 +135,7 @@ int main (int argc, char ** argv) { struct torrent * torrent = torrent_init(); 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 = /* (useless, since we have no listening system yet) announce | */ peers | info; + torrent->ttl = seconds()+128; /**< idk, enough to bootstrap i guess */ add_torrent(dht, torrent); periodic(dht); // alarm(PERIODIC); @@ -143,6 +144,7 @@ w: if (sigusr1) { sigusr1 = 0; dht_print(stdout, dht); + fflush(stdout); goto w; } if (periodično) { @@ -160,6 +162,7 @@ w: if (sigusr1) { sigusr1 = 0; dht_print(stdout, dht); + fflush(stdout); goto w; } if (periodično) { -- cgit v1.2.3