diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-07-05 10:31:29 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-05 23:09:28 +0000 |
commit | 8739f7fccb7cafc54ca0f5fa074c9a740f7048ba (patch) | |
tree | 88e9f53fa6e734cd8095487d1896c56f844c782c /other/bootstrap_daemon/src | |
parent | 64d0297acc7d6a1697683052e15cc76383312c38 (diff) |
Make tox.c unambiguously parseable.
Rules:
1. Constants are uppercase names: THE_CONSTANT.
2. SUE[1] types start with an uppercase letter and have at least one
lowercase letter in it: The_Type, THE_Type.
3. Function types end in "_cb": tox_friend_connection_cb.
4. Variable and function names are all lowercase: the_function.
This makes it easier for humans reading the code to determine what an
identifier means. I'm not convinced by the enum type name change, but I
don't know a better rule. Currently, a lot of enum types are spelled like
constants, which is confusing.
[1] struct/union/enum
Diffstat (limited to 'other/bootstrap_daemon/src')
-rw-r--r-- | other/bootstrap_daemon/src/config.c | 2 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/other/bootstrap_daemon/src/config.c b/other/bootstrap_daemon/src/config.c index a3c1f250..9fde33b2 100644 --- a/other/bootstrap_daemon/src/config.c +++ b/other/bootstrap_daemon/src/config.c | |||
@@ -408,7 +408,7 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6) | |||
408 | } | 408 | } |
409 | 409 | ||
410 | bs_public_key_bin = hex_string_to_bin(bs_public_key); | 410 | bs_public_key_bin = hex_string_to_bin(bs_public_key); |
411 | address_resolved = DHT_bootstrap_from_address(dht, bs_address, enable_ipv6, net_htons(bs_port), | 411 | address_resolved = dht_bootstrap_from_address(dht, bs_address, enable_ipv6, net_htons(bs_port), |
412 | bs_public_key_bin); | 412 | bs_public_key_bin); |
413 | free(bs_public_key_bin); | 413 | free(bs_public_key_bin); |
414 | 414 | ||
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index ea849673..3c6d5d2c 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -250,7 +250,7 @@ int main(int argc, char *argv[]) | |||
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | DHT *dht = new_DHT(logger, net, true); | 253 | DHT *dht = new_dht(logger, net, true); |
254 | 254 | ||
255 | if (dht == nullptr) { | 255 | if (dht == nullptr) { |
256 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n"); | 256 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n"); |
@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) | |||
333 | } | 333 | } |
334 | 334 | ||
335 | while (1) { | 335 | while (1) { |
336 | do_DHT(dht); | 336 | do_dht(dht); |
337 | 337 | ||
338 | if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { | 338 | if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { |
339 | lan_discovery_send(net_htons_port, dht); | 339 | lan_discovery_send(net_htons_port, dht); |
@@ -346,7 +346,7 @@ int main(int argc, char *argv[]) | |||
346 | 346 | ||
347 | networking_poll(dht_get_net(dht), nullptr); | 347 | networking_poll(dht_get_net(dht), nullptr); |
348 | 348 | ||
349 | if (waiting_for_dht_connection && DHT_isconnected(dht)) { | 349 | if (waiting_for_dht_connection && dht_isconnected(dht)) { |
350 | log_write(LOG_LEVEL_INFO, "Connected to another bootstrap node successfully.\n"); | 350 | log_write(LOG_LEVEL_INFO, "Connected to another bootstrap node successfully.\n"); |
351 | waiting_for_dht_connection = 0; | 351 | waiting_for_dht_connection = 0; |
352 | } | 352 | } |