Commit c821f24d authored by Andrei Vagin's avatar Andrei Vagin

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-67026Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 865f099d
...@@ -209,6 +209,18 @@ static int refresh_sk(struct libsoccr_sk *sk, ...@@ -209,6 +209,18 @@ static int refresh_sk(struct libsoccr_sk *sk,
data->unsq_len = size; 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. */ /* Don't account the fin packet. It doesn't countain real data. */
if ((1 << data->state) & (SNDQ_FIRST_FIN | SNDQ_SECOND_FIN)) { if ((1 << data->state) & (SNDQ_FIRST_FIN | SNDQ_SECOND_FIN)) {
if (data->outq_len) if (data->outq_len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment