Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file for pools #461

Merged
merged 7 commits into from
Dec 6, 2018
Merged

Config file for pools #461

merged 7 commits into from
Dec 6, 2018

Conversation

zpcsa
Copy link

@zpcsa zpcsa commented Nov 19, 2018

#329 Config file for pools

zhoup and others added 3 commits November 19, 2018 11:27
Copy link
Contributor

@jonano614 jonano614 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnak you for your great efforts! Could you please write short manual how to set config file?

client/init.c Outdated Show resolved Hide resolved
client/init.c Outdated Show resolved Hide resolved
client/init.c Show resolved Hide resolved
client/init.c Outdated Show resolved Hide resolved
client/netdb-testnet.txt Show resolved Hide resolved
client/xdag_config.c Outdated Show resolved Hide resolved
char *line = NULL;
int line_len = 0, buf_len = 0;

while(!feof(fp))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You read line from file. Do the lines really can be so long, so you need to read them in several iterations?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I am worried that there may be an expansion later.

client/xdag_config.c Show resolved Hide resolved
client/xdag_config.c Outdated Show resolved Hide resolved
client/xdag_config.c Outdated Show resolved Hide resolved
zhoup added 2 commits November 24, 2018 16:48
Delete 4 empty lines
combine variable declaration and usage
len-2+1 Maybe just len-1
Copy link
Contributor

@sgaragagghu sgaragagghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some memory leaks where you use strdup

@zpcsa
Copy link
Author

zpcsa commented Nov 25, 2018

All strdup is free when xdag_config_close closed

@sgaragagghu
Copy link
Contributor

All strdup is free when xdag_config_close closed

saw now, great

@sgaragagghu
Copy link
Contributor

your parser seems good!
can you check if strdup, malloc, realloc fails?

@zpcsa
Copy link
Author

zpcsa commented Nov 25, 2018

your parser seems good!
can you check if strdup, malloc, realloc fails?

Thank you for your suggestion, ok, I will modify it.

{
return TYPE_KEY;
}
return TYPE_UNKNOW;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you print the line in xdag_err TYPE_UNKNOW case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you print the line in xdag_err TYPE_UNKNOW case?

ok



char * get_pool_config(const char *path){
static char result[80];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why static?


char * get_pool_config(const char *path){
static char result[80];
if(path) {
Copy link
Contributor

@sgaragagghu sgaragagghu Nov 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't use strcat? strncat(result, str,strlen(str)) makes no sense
and i see that you doesn't check the buffer overflow!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote this function.

Copy link
Contributor

@sgaragagghu sgaragagghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems good, we can fix the style later

@jonano614
Copy link
Contributor

Just two questions:

  1. is there a default path for config file? Something like pool.config?
  2. could you please make an example of configuration file?

@zpcsa
Copy link
Author

zpcsa commented Dec 5, 2018

Just two questions:

  1. is there a default path for config file? Something like pool.config?
  2. could you please make an example of configuration file?

1.No default path for config file,but there is a sample file in "/xdag/client/example.ini".
2.The configuration file format is as follows:
[POOL]
#pool ip
ip = 127.0.0.1
#pool port
port = 65535
max_connection_count_input = 4096
max_miner_ip_count = 128
connections_per_miner_limit = 128
pool_fee = 1
pool_reward = 5
pool_direct = 5
pool_fund = 0.5

The xdag startup command is as follows:
./xdag -f /xdag/client/example.ini -p 127.0.0.1:3366 -rpc-enable -rpc-port 8989
If the startup command has a -p parameter, like this
./xdag -f /xdag/client/example.ini -p 127.0.0.1:3366 -P 127.0.0.1:8888:4096:128:128:1:5:5:0.5 -rpc-enable -rpc-port 8989
Will startup xdag with the -p command。

@jonano614
Copy link
Contributor

Ok, thank you for you great efforts.
I think we need some default path for config file.

@jonano614 jonano614 merged commit 0c38334 into XDagger:develop Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants