aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-05 22:17:56 +0200
committerMattias Andrée <maandree@kth.se>2016-08-05 22:17:56 +0200
commit6f6af6fea60db36d742ff335b7994be493072f9e (patch)
tree8146fb7f8a626546297f181a117c1ae72f464d74
parentFix unmarshal bug (diff)
downloadcoopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.gz
coopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.bz2
coopgammad-6f6af6fea60db36d742ff335b7994be493072f9e.tar.xz
Fix disconnect bug
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/servers/coopgamma.c7
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)