diff options
author | liuyacan <liuyacan@corp.netease.com> | 2021-05-09 03:50:40 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-05-12 04:45:07 +0000 |
commit | 534468e9f768ae7465ef722520dadfd916cdc9fb (patch) | |
tree | 7433d66e807340a2b5e0abbe152b6b944f32675d /src/vcl/vcl_locked.c | |
parent | 7b2917fbe2a9ec17f69ca94fcbae534927915834 (diff) |
session: support half-close connection
Some app(e.g. Envoy) may call shutdown() instead of close() when
draining connection.
Type: improvement
Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Change-Id: I9543b9ca3caa87b10b134fd1fc4019124e41e4d2
Diffstat (limited to 'src/vcl/vcl_locked.c')
-rw-r--r-- | src/vcl/vcl_locked.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c index 757c0fc45a7..69f492b8694 100644 --- a/src/vcl/vcl_locked.c +++ b/src/vcl/vcl_locked.c @@ -1313,6 +1313,24 @@ vls_close (vls_handle_t vlsh) return rv; } +int +vls_shutdown (vls_handle_t vlsh) +{ + vcl_locked_session_t *vls; + int rv; + + vls_mt_detect (); + if (!(vls = vls_get_w_dlock (vlsh))) + return VPPCOM_EBADFD; + + vls_mt_guard (vls, VLS_MT_OP_SPOOL); + rv = vppcom_session_shutdown (vls_to_sh (vls)); + vls_mt_unguard (); + vls_get_and_unlock (vlsh); + + return rv; +} + vls_handle_t vls_epoll_create (void) { |