Page MenuHomePhabricator

Update seeder files to use fprintf() instead of printf()
ClosedPublic

Authored by nakihito on Mon, Oct 7, 23:08.

Details

Reviewers
deadalnix
Fabien
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCabb7cfc0104c: Update seeder files to use fprintf() instead of printf()
Summary

Using fprintf() allows us more control over where text is output to. This is especially relevant if we wish to change some of the output to a log file or stderr rather than the current behavior of outputting solely to stdout. It also better clarifies where the text is being output to making the code easier.

Scripted diff using
sed -i -e 's/printf(\"/fprintf(stdout,\"/g' ./seeder/*

Test Plan
make
bitcoin-seeder

Make sure seeder is outputting something like:

Supporting whitelisted filters: 0x1,0x5,0x11,0x15
No nameserver set. Not starting DNS server.
Loading dnsseed.dat...done
Starting seeder...done
Starting 96 crawler threads...2019-10-07T23:03:47Z connect() to [2001:67c:130c:254::46]:8333 failed: Cannot assign requested address (99)
...

bitcoin-seeder -h seeder.bitframe.org -n dev.bitframe.org -p 5364 -m info@bitframe.org --testnet

This should output something like:

Supporting whitelisted filters: 0x1,0x5,0x11,0x15
Using testnet.
Loading dnsseed.dat...done
Starting 4 DNS threads for seeder.bitframe.org on dev.bitframe.org (port 5364).......done
Starting seeder...done
Starting 96 crawler threads...2019-10-07T23:06:18Z connect() to [2001:67c:130c:254::46]:8333 failed: Cannot assign requested address (99)
...

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Mon, Oct 7, 23:08
Owners added a reviewer: Restricted Owners Package.Mon, Oct 7, 23:08
Herald added a reviewer: Restricted Project. · View Herald TranscriptMon, Oct 7, 23:08
nakihito planned changes to this revision.Mon, Oct 7, 23:08
nakihito edited the test plan for this revision. (Show Details)
nakihito requested review of this revision.Tue, Oct 8, 00:07
deadalnix requested changes to this revision.Tue, Oct 8, 14:56

What is the goal of this? Why does it depends on D4216?

This revision now requires changes to proceed.Tue, Oct 8, 14:56
nakihito requested review of this revision.Wed, Oct 9, 01:12
nakihito edited the summary of this revision. (Show Details)

Edited summary to better express the reasoning behind this change. Also removed unnecessary dependency.

deadalnix accepted this revision.Sat, Oct 12, 13:09
This revision is now accepted and ready to land.Sat, Oct 12, 13:09