UlricE / pen

Pen
Other
250 stars 41 forks source link

`conn_max` doesn't function in config file. It modifies clients_max instead of connections_max #38

Open BelindaLiu opened 7 years ago

BelindaLiu commented 7 years ago

Observation:

set conn_max in config file pen_config and run:

bash-4.3# cat pen_config
listen 0.0.0.0:5353
server 1 address 127.0.0.1 port 31671 weight 1
conn_max 1000
bash-4.3# pen -f -F pen_config
0.0.0.0:5353
2017-02-14 09:54:39: do_cmd: server 1 address 127.0.0.1
0
2017-02-14 09:54:39: Before: conns = 0, connections_max = 0, clients = 0x56434c105020, clients_max = 1000
2017-02-14 09:54:39: After: conns = 0x56434c12e080, connections_max = 500, clients = 0x56434c105020, clients_max = 1000

In the result above, the clients_max has been changed to 1000, however, the connections_max has NOT as expected.

Possible reason:

We find the possible typo in file pen.c, from line 1313 to 1317 as follow,

    } else if (!strcmp(p, "conn_max")) {
        p = strtok(NULL, " ");
        if (p) expand_clienttable(atoi(p));
        output(op, "%d\n", connections_max);

I think the function should be expand_conntable instead of expand_clienttable.

UlricE commented 7 years ago

You are right. The typo has been fixed and a correct version will be released shortly.