Skip to content

Commit

Permalink
fix a stat overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jtgrassie committed Apr 17, 2023
1 parent d48f5a6 commit cb9d807
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,8 @@ trusted_on_account_connect(client_t *client)
static void
trusted_on_account_disconnect(client_t *client)
{
pool_stats.connected_accounts--;
if (pool_stats.connected_accounts)
pool_stats.connected_accounts--;
if (client->downstream_accounts)
client->downstream_accounts--;
log_trace("Downstream account disconnected");
Expand Down Expand Up @@ -3008,7 +3009,8 @@ client_clear(struct bufferevent *bev)
return;
if (client->downstream)
{
pool_stats.connected_accounts -= client->downstream_accounts;
if (pool_stats.connected_accounts >= client->downstream_accounts)
pool_stats.connected_accounts -= client->downstream_accounts;
goto clear;
}
pthread_rwlock_rdlock(&rwlock_acc);
Expand All @@ -3018,8 +3020,10 @@ client_clear(struct bufferevent *bev)
goto clear;
if (account->worker_count == 1)
{
account_count--;
pool_stats.connected_accounts--;
if (account_count)
account_count--;
if (pool_stats.connected_accounts)
pool_stats.connected_accounts--;
if (upstream_event)
upstream_send_account_disconnect();
pthread_rwlock_wrlock(&rwlock_acc);
Expand Down

0 comments on commit cb9d807

Please sign in to comment.