summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/transport.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 0020d743d9b..8b3dacfe309 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -578,10 +578,6 @@ transport_alloc_local_port (u8 proto, ip46_address_t *lcl_addr,
/* Only support active opens from one of ctrl threads */
ASSERT (vlib_get_thread_index () <= transport_cl_thread ());
- /* Cleanup freelist if need be */
- if (vec_len (tm->lcl_endpts_freelist))
- transport_cleanup_freelist ();
-
/* Search for first free slot */
for (tries = 0; tries < limit; tries++)
{
@@ -669,6 +665,7 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg,
ip46_address_t * lcl_addr, u16 * lcl_port)
{
transport_endpoint_t *rmt = (transport_endpoint_t *) rmt_cfg;
+ transport_main_t *tm = &tp_main;
session_error_t error;
int port;
@@ -689,6 +686,10 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg,
sizeof (rmt_cfg->peer.ip));
}
+ /* Cleanup freelist if need be */
+ if (vec_len (tm->lcl_endpts_freelist))
+ transport_cleanup_freelist ();
+
/*
* Allocate source port
*/