diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/opentracker.c | 8 | ||||
| -rw-r--r-- | src/trackerlogic.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/opentracker.c b/src/opentracker.c index 65fe382..e467ce6 100644 --- a/src/opentracker.c +++ b/src/opentracker.c | |||
| @@ -300,7 +300,7 @@ void load_state(const char *const state_filename) { | |||
| 300 | FILE *state_filehandle; | 300 | FILE *state_filehandle; |
| 301 | char inbuf[512]; | 301 | char inbuf[512]; |
| 302 | ot_hash infohash; | 302 | ot_hash infohash; |
| 303 | uint64_t base, downcount; | 303 | uint64_t age, downcount; |
| 304 | int consumed; | 304 | int consumed; |
| 305 | 305 | ||
| 306 | state_filehandle = fopen(state_filename, "r"); | 306 | state_filehandle = fopen(state_filename, "r"); |
| @@ -318,12 +318,12 @@ void load_state(const char *const state_filename) { | |||
| 318 | continue; | 318 | continue; |
| 319 | i = 2 * sizeof(ot_hash); | 319 | i = 2 * sizeof(ot_hash); |
| 320 | 320 | ||
| 321 | if (inbuf[i++] != ':' || !(consumed = scan_uint(inbuf + i, &base, UINT64_MAX))) | 321 | if (inbuf[i++] != ':' || !(consumed = scan_uint(inbuf + i, &age, OT_TORRENT_TIMEOUT))) |
| 322 | continue; | 322 | continue; |
| 323 | i += consumed; | 323 | i += consumed; |
| 324 | if (inbuf[i++] != ':' || !(consumed = scan_uint(inbuf + i, &downcount, UINT64_MAX))) | 324 | if (inbuf[i++] != ':' || !(consumed = scan_uint(inbuf + i, &downcount, SIZE_MAX))) |
| 325 | continue; | 325 | continue; |
| 326 | add_torrent_from_saved_state(infohash, base, downcount); | 326 | add_torrent_from_saved_state(infohash, (ot_time)age, (size_t)downcount); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | fclose(state_filehandle); | 329 | fclose(state_filehandle); |
diff --git a/src/trackerlogic.c b/src/trackerlogic.c index 2313379..9fd6114 100644 --- a/src/trackerlogic.c +++ b/src/trackerlogic.c | |||
| @@ -45,7 +45,7 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time age, size_t down_c | |||
| 45 | ot_torrent *torrent; | 45 | ot_torrent *torrent; |
| 46 | ot_vector *torrents_list; | 46 | ot_vector *torrents_list; |
| 47 | 47 | ||
| 48 | if (age > OT_TORRENT_TIMEOUT) | 48 | if (age < 0 || age > OT_TORRENT_TIMEOUT) |
| 49 | return; | 49 | return; |
| 50 | 50 | ||
| 51 | torrents_list = mutex_bucket_lock_by_hash(hash); | 51 | torrents_list = mutex_bucket_lock_by_hash(hash); |
