[POOL] refactor memory in HTTP server (#3196)

Removed ogs_pool_cycle() from HTTP2 session and stream context
and changed it to find by hash id.
This commit is contained in:
Sukchan Lee
2024-06-12 14:35:05 +09:00
parent 40e146d45a
commit 6cb518539b
43 changed files with 838 additions and 243 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -45,6 +45,7 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
af_sess_t *sess = NULL;
ogs_sbi_stream_t *stream = NULL;
ogs_pool_id_t stream_id = 0;
ogs_sbi_request_t *request = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
@@ -68,8 +69,16 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
case OGS_EVENT_SBI_SERVER:
request = e->h.sbi.request;
ogs_assert(request);
stream = e->h.sbi.data;
ogs_assert(stream);
stream_id = OGS_POINTER_TO_UINT(e->h.sbi.data);
ogs_assert(stream_id >= OGS_MIN_POOL_ID &&
stream_id <= OGS_MAX_POOL_ID);
stream = ogs_sbi_stream_find_by_id(stream_id);
if (!stream) {
ogs_error("STREAM has already been removed [%d]", stream_id);
break;
}
rv = ogs_sbi_parse_request(&message, request);
if (rv != OGS_OK) {
@@ -501,7 +510,9 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
break;
}
stream = sbi_xact->assoc_stream;
if (sbi_xact->assoc_stream_id >= OGS_MIN_POOL_ID &&
sbi_xact->assoc_stream_id <= OGS_MAX_POOL_ID)
stream = ogs_sbi_stream_find_by_id(sbi_xact->assoc_stream_id);
/* Here, we should not use ogs_assert(stream)
* since 'namf-comm' service has no an associated stream. */