Prevent connection double counts in tests

The function would count a connection twice if hostname resolution was not
enabled and both the host and the IP matched.
This commit is contained in:
Markus Mäkelä 2018-11-18 22:38:25 +02:00
parent 601c2d6633
commit 47092ed18a
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -456,12 +456,11 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
row = mysql_fetch_row(res);
if ((row[2] != NULL ) && (row[3] != NULL))
{
if ((strstr(row[2], ip.c_str()) != NULL) && (strstr(row[3], db.c_str()) != NULL))
if (strstr(row[2], ip.c_str()) && strstr(row[3], db.c_str()))
{
conn_num++;
}
if ((strstr(row[2],
hostname_internal) != NULL) && (strstr(row[3], db.c_str()) != NULL))
else if (strstr(row[2], hostname_internal) && strstr(row[3], db.c_str()))
{
conn_num++;
}