diff options
Diffstat (limited to 'ot_stats.c')
| -rw-r--r-- | ot_stats.c | 22 |
1 files changed, 11 insertions, 11 deletions
| @@ -345,15 +345,15 @@ size_t stats_top_txt(char *reply, size_t amount) { | |||
| 345 | r += sprintf(r, "Top %zd torrents by peers:\n", amount); | 345 | r += sprintf(r, "Top %zd torrents by peers:\n", amount); |
| 346 | for (idx = 0; idx < amount; ++idx) | 346 | for (idx = 0; idx < amount; ++idx) |
| 347 | if (top100c[idx].val) | 347 | if (top100c[idx].val) |
| 348 | r += sprintf(r, "\t%zd\t%s\n", top100c[idx].val, hex_fromhash(hex_out, top100c[idx].hash)); | 348 | r += sprintf(r, "\t%zd\t%s\n", top100c[idx].val, hex_from_hash(hex_out, top100c[idx].hash)); |
| 349 | r += sprintf(r, "Top %zd torrents by seeds:\n", amount); | 349 | r += sprintf(r, "Top %zd torrents by seeds:\n", amount); |
| 350 | for (idx = 0; idx < amount; ++idx) | 350 | for (idx = 0; idx < amount; ++idx) |
| 351 | if (top100s[idx].val) | 351 | if (top100s[idx].val) |
| 352 | r += sprintf(r, "\t%zd\t%s\n", top100s[idx].val, hex_fromhash(hex_out, top100s[idx].hash)); | 352 | r += sprintf(r, "\t%zd\t%s\n", top100s[idx].val, hex_from_hash(hex_out, top100s[idx].hash)); |
| 353 | r += sprintf(r, "Top %zd torrents by leechers:\n", amount); | 353 | r += sprintf(r, "Top %zd torrents by leechers:\n", amount); |
| 354 | for (idx = 0; idx < amount; ++idx) | 354 | for (idx = 0; idx < amount; ++idx) |
| 355 | if (top100l[idx].val) | 355 | if (top100l[idx].val) |
| 356 | r += sprintf(r, "\t%zd\t%s\n", top100l[idx].val, hex_fromhash(hex_out, top100l[idx].hash)); | 356 | r += sprintf(r, "\t%zd\t%s\n", top100l[idx].val, hex_from_hash(hex_out, top100l[idx].hash)); |
| 357 | 357 | ||
| 358 | return r - reply; | 358 | return r - reply; |
| 359 | } | 359 | } |
| @@ -459,7 +459,7 @@ static void stats_return_fulllog(size_t *iovec_entries, struct iovec **iovector, | |||
| 459 | 459 | ||
| 460 | while (loglist) { | 460 | while (loglist) { |
| 461 | if (r + (loglist->size + 64) >= re) { | 461 | if (r + (loglist->size + 64) >= re) { |
| 462 | r = iovec_fix_increase_or_free(iovec_entries, iovector, r, 32 * OT_STATS_TMPSIZE); | 462 | r = iovec_next_chunk(iovec_entries, iovector, r, 32 * OT_STATS_TMPSIZE); |
| 463 | if (!r) | 463 | if (!r) |
| 464 | return; | 464 | return; |
| 465 | re = r + 32 * OT_STATS_TMPSIZE; | 465 | re = r + 32 * OT_STATS_TMPSIZE; |
| @@ -479,7 +479,7 @@ static void stats_return_fulllog(size_t *iovec_entries, struct iovec **iovector, | |||
| 479 | free(loglist); | 479 | free(loglist); |
| 480 | loglist = llnext; | 480 | loglist = llnext; |
| 481 | } | 481 | } |
| 482 | iovec_fixlast(iovec_entries, iovector, r); | 482 | iovec_trim_last(iovec_entries, iovector, r); |
| 483 | } | 483 | } |
| 484 | #endif | 484 | #endif |
| 485 | 485 | ||
| @@ -570,7 +570,7 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty | |||
| 570 | 570 | ||
| 571 | *iovec_entries = 0; | 571 | *iovec_entries = 0; |
| 572 | *iovector = NULL; | 572 | *iovector = NULL; |
| 573 | if (!(r = iovec_increase(iovec_entries, iovector, OT_STATS_TMPSIZE))) | 573 | if (!(r = iovec_new_chunk(iovec_entries, iovector, OT_STATS_TMPSIZE))) |
| 574 | return; | 574 | return; |
| 575 | 575 | ||
| 576 | switch (mode & TASK_TASK_MASK) { | 576 | switch (mode & TASK_TASK_MASK) { |
| @@ -587,13 +587,13 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty | |||
| 587 | r += stats_top_txt(r, 10); | 587 | r += stats_top_txt(r, 10); |
| 588 | break; | 588 | break; |
| 589 | case TASK_STATS_TOP100: | 589 | case TASK_STATS_TOP100: |
| 590 | r = iovec_fix_increase_or_free(iovec_entries, iovector, r, 4 * OT_STATS_TMPSIZE); | 590 | r = iovec_next_chunk(iovec_entries, iovector, r, 4 * OT_STATS_TMPSIZE); |
| 591 | if (!r) | 591 | if (!r) |
| 592 | return; | 592 | return; |
| 593 | r += stats_top_txt(r, 100); | 593 | r += stats_top_txt(r, 100); |
| 594 | break; | 594 | break; |
| 595 | case TASK_STATS_EVERYTHING: | 595 | case TASK_STATS_EVERYTHING: |
| 596 | r = iovec_fix_increase_or_free(iovec_entries, iovector, r, OT_STATS_TMPSIZE + 64 * OT_PEER_TIMEOUT); | 596 | r = iovec_next_chunk(iovec_entries, iovector, r, OT_STATS_TMPSIZE + 64 * OT_PEER_TIMEOUT); |
| 597 | if (!r) | 597 | if (!r) |
| 598 | return; | 598 | return; |
| 599 | r += stats_return_everything(r); | 599 | r += stats_return_everything(r); |
| @@ -612,7 +612,7 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty | |||
| 612 | iovec_free(iovec_entries, iovector); | 612 | iovec_free(iovec_entries, iovector); |
| 613 | return; | 613 | return; |
| 614 | } | 614 | } |
| 615 | iovec_fixlast(iovec_entries, iovector, r); | 615 | iovec_trim_last(iovec_entries, iovector, r); |
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_data) { | 618 | void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_data) { |
| @@ -651,9 +651,9 @@ void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_ | |||
| 651 | localtime_r(&ttt, &time_now); | 651 | localtime_r(&ttt, &time_now); |
| 652 | strftime(timestring, sizeof(timestring), "%FT%T%z", &time_now); | 652 | strftime(timestring, sizeof(timestring), "%FT%T%z", &time_now); |
| 653 | 653 | ||
| 654 | hex_fromhash(hash_hex, *ws->hash); | 654 | hex_from_hash(hash_hex, *ws->hash); |
| 655 | if (ws->peer_id) | 655 | if (ws->peer_id) |
| 656 | hex_fromhash(peerid_hex, (uint8_t *)ws->peer_id); | 656 | hex_from_hash(peerid_hex, (uint8_t *)ws->peer_id); |
| 657 | else { | 657 | else { |
| 658 | *peerid_hex = 0; | 658 | *peerid_hex = 0; |
| 659 | } | 659 | } |
