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:
@ -456,12 +456,11 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
|
|||||||
row = mysql_fetch_row(res);
|
row = mysql_fetch_row(res);
|
||||||
if ((row[2] != NULL ) && (row[3] != NULL))
|
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++;
|
conn_num++;
|
||||||
}
|
}
|
||||||
if ((strstr(row[2],
|
else if (strstr(row[2], hostname_internal) && strstr(row[3], db.c_str()))
|
||||||
hostname_internal) != NULL) && (strstr(row[3], db.c_str()) != NULL))
|
|
||||||
{
|
{
|
||||||
conn_num++;
|
conn_num++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user