mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-20 00:10:41 -05:00
MINOR: sink: distinguish between hard and soft close in _sink_forward_io_handler()
Aborting the socket on soft-stop is not the same as aborting it due to unexpected error. As such, let's leverage the granularity offered by sedesc flags to better reflect the situation: abort during soft-stop is handled as a soft close thanks to EOI+EOS flags, while abort due to unexpected error is handled as hard error thanks to ERROR+EOS flags. Thanks to this change, hard error will always emit RST packet even if the NOLINGER option wasn't set on the socket.
This commit is contained in:
parent
b40d804c7f
commit
c6ab0e14e2
1 changed files with 6 additions and 3 deletions
|
|
@ -361,7 +361,7 @@ static void _sink_forward_io_handler(struct appctx *appctx,
|
|||
|
||||
/* if stopping was requested, close immediately */
|
||||
if (unlikely(stopping))
|
||||
goto close;
|
||||
goto soft_close;
|
||||
|
||||
/* if the connection is not established, inform the stream that we want
|
||||
* to be notified whenever the connection completes.
|
||||
|
|
@ -377,7 +377,7 @@ static void _sink_forward_io_handler(struct appctx *appctx,
|
|||
if (appctx != sft->appctx) {
|
||||
/* FIXME: is this even supposed to happen? */
|
||||
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
|
||||
goto close;
|
||||
goto hard_close;
|
||||
}
|
||||
|
||||
MT_LIST_DELETE(&appctx->wait_entry);
|
||||
|
|
@ -404,8 +404,11 @@ out:
|
|||
co_skip(sc_oc(sc), sc_oc(sc)->output);
|
||||
return;
|
||||
|
||||
close:
|
||||
soft_close:
|
||||
se_fl_set(appctx->sedesc, SE_FL_EOS|SE_FL_EOI);
|
||||
return;
|
||||
hard_close:
|
||||
se_fl_set(appctx->sedesc, SE_FL_EOS|SE_FL_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue