diff options
author | Andrei Vagin <avagin@virtuozzo.com> | 2017-10-07 00:31:54 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@virtuozzo.com> | 2017-10-17 08:40:44 +0300 |
commit | c821f24d5bfeb66e286b05f8163a24fd5e38e326 (patch) | |
tree | 088d2d0f2359bedb3b73632fc2389e8944fee269 /soccr | |
parent | 865f099d702a94a8e429359869f38a938e498f15 (diff) |
libsoccr: ignore data in a sent queue, if a connect is closed
If a connection was reseted, it can have some data in a sent queue,
a use can't read this data, so we can ignore them too.
https://jira.sw.ru/browse/PSBM-67026
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'soccr')
-rw-r--r-- | soccr/soccr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/soccr/soccr.c b/soccr/soccr.c index 1a1aaa35d..394095f00 100644 --- a/soccr/soccr.c +++ b/soccr/soccr.c @@ -209,6 +209,18 @@ static int refresh_sk(struct libsoccr_sk *sk, data->unsq_len = size; + if (data->state == TCP_CLOSE) { + /* A connection could be reseted. In thise case a sent queue + * may contain some data. A user can't read this data, so let's + * ignore them. Otherwise we will need to add a logic whether + * the send queue contains a fin packet or not and decide whether + * a fin or reset packet has to be sent to restore a state + */ + + data->unsq_len = 0; + data->outq_len = 0; + } + /* Don't account the fin packet. It doesn't countain real data. */ if ((1 << data->state) & (SNDQ_FIRST_FIN | SNDQ_SECOND_FIN)) { if (data->outq_len) |