diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-05 22:17:56 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-05 22:17:56 +0200 |
commit | 6f6af6fea60db36d742ff335b7994be493072f9e (patch) | |
tree | 8146fb7f8a626546297f181a117c1ae72f464d74 | |
parent | Fix unmarshal bug (diff) | |
download | coopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.gz coopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.bz2 coopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.xz |
Fix disconnect bug
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | src/servers/coopgamma.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/servers/coopgamma.c b/src/servers/coopgamma.c index 4e126cf..b96df10 100644 --- a/src/servers/coopgamma.c +++ b/src/servers/coopgamma.c @@ -228,6 +228,11 @@ int connection_closed(int client) ssize_t updated = -1; for (j = k = 0; j < output->table_size; j += !remove, k++) { + if (j != k) + { + output->table_filters[j] = output->table_filters[k]; + output->table_sums[j] = output->table_sums[k]; + } remove = output->table_filters[j].client == client; remove = remove && (output->table_filters[j].lifespan == LIFESPAN_UNTIL_DEATH); if (remove) @@ -238,8 +243,6 @@ int connection_closed(int client) if (updated == -1) updated = (ssize_t)j; } - output->table_filters[j] = output->table_filters[k]; - output->table_sums[j] = output->table_sums[k]; } if (updated >= 0) if (flush_filters(output, (size_t)updated) < 0) |