diff options
author | Florin Coras <fcoras@cisco.com> | 2019-01-29 20:11:58 -0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-01-31 20:00:58 +0000 |
commit | 6d0106e44e7dff2c9ef0f7052c4023245e9023a8 (patch) | |
tree | c7371268631887c0ae7391e15b7bd02478ea37f3 /src/vcl/vcl_private.h | |
parent | f5de036c91505956d96590a5afe4e3cf1bc21b56 (diff) |
vcl: improve handling of close on rw
Change-Id: Ie01a37612d7e3e0d0bad0f0aa9583b3ed411f46f
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vcl_private.h')
-rw-r--r-- | src/vcl/vcl_private.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index c61bb0b9247..39c9e7207c7 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -504,6 +504,34 @@ vcl_session_is_ct (vcl_session_t * s) return (s->our_evt_q != 0); } +static inline u8 +vcl_session_is_open (vcl_session_t * s) +{ + return ((s->session_state & STATE_OPEN) + || (s->session_state == STATE_LISTEN + && s->session_type == VPPCOM_PROTO_UDP)); +} + +static inline u8 +vcl_session_is_closing (vcl_session_t * s) +{ + return (s->session_state == STATE_VPP_CLOSING + || s->session_state == STATE_DISCONNECT); +} + +static inline int +vcl_session_closing_error (vcl_session_t * s) +{ + return s->session_state == STATE_DISCONNECT ? VPPCOM_ECONNRESET : 0; +} + +static inline int +vcl_session_closed_error (vcl_session_t * s) +{ + return s->session_state == STATE_DISCONNECT + ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN; +} + /* * Helpers */ |