aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-07 22:31:06 +0000
committerFlorin Coras <fcoras@cisco.com>2020-04-07 22:48:23 +0000
commita8c3b86ebebea357b89ad181bb4c141db4c6505d (patch)
tree4f98a0fd7a338265fd4ad55f466808a9b2eabdbf /src/vnet/session/session.c
parent95e19253320ab07748787f4c8a7620704563f6b8 (diff)
session: add more session errors
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9b246eb8a99020de9e5859147c456096fe2e3389
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 79f93c40693..37c5d915008 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1212,7 +1212,8 @@ int
session_listen (session_t * ls, session_endpoint_cfg_t * sep)
{
transport_endpoint_t *tep;
- u32 tc_index, s_index;
+ int tc_index;
+ u32 s_index;
/* Transport bind/listen */
tep = session_endpoint_to_transport (sep);
@@ -1220,8 +1221,8 @@ session_listen (session_t * ls, session_endpoint_cfg_t * sep)
tc_index = transport_start_listen (session_get_transport_proto (ls),
s_index, tep);
- if (tc_index == (u32) ~ 0)
- return -1;
+ if (tc_index < 0)
+ return tc_index;
/* Attach transport to session. Lookup tables are populated by the app
* worker because local tables (for ct sessions) are not backed by a fib */
@@ -1243,14 +1244,17 @@ session_stop_listen (session_t * s)
transport_connection_t *tc;
if (s->session_state != SESSION_STATE_LISTENING)
- return -1;
+ return SESSION_E_NOLISTEN;
tc = transport_get_listener (tp, s->connection_index);
+
+ /* If no transport, assume everything was cleaned up already */
if (!tc)
- return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
+ return SESSION_E_NONE;
if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
session_lookup_del_connection (tc);
+
transport_stop_listen (tp, s->connection_index);
return 0;
}