From b80db453e88e95956ee4577a81fc7a73e4267e83 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Fri, 17 Feb 2023 06:55:22 +0900 Subject: [PATCH] [GTP/PFCP] Follow-up on #2073 --- lib/gtp/xact.c | 23 ++++------------------- lib/pfcp/xact.c | 17 ++++------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/lib/gtp/xact.c b/lib/gtp/xact.c index 056fd85a9..89dec295e 100644 --- a/lib/gtp/xact.c +++ b/lib/gtp/xact.c @@ -443,7 +443,6 @@ int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact, static int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type) { - int rv = OGS_OK; char buf[OGS_ADDRSTRLEN]; ogs_gtp_xact_stage_t stage; @@ -491,8 +490,7 @@ static int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type) OGS_ADDR(&xact->gnode->addr, buf), OGS_PORT(&xact->gnode->addr)); - rv = ogs_gtp_sendto(xact->gnode, pkbuf); - ogs_expect(rv == OGS_OK); + ogs_expect(OGS_OK == ogs_gtp_sendto(xact->gnode, pkbuf)); } else { ogs_warn("[%d] %s Request Duplicated. Discard!" " for step %d type %d peer [%s]:%d", @@ -557,8 +555,7 @@ static int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type) OGS_ADDR(&xact->gnode->addr, buf), OGS_PORT(&xact->gnode->addr)); - rv = ogs_gtp_sendto(xact->gnode, pkbuf); - ogs_expect(rv == OGS_OK); + ogs_expect(OGS_OK == ogs_gtp_sendto(xact->gnode, pkbuf)); } else { ogs_warn("[%d] %s Request Duplicated. Discard!" " for step %d type %d peer [%s]:%d", @@ -726,11 +723,7 @@ int ogs_gtp_xact_commit(ogs_gtp_xact_t *xact) pkbuf = xact->seq[xact->step-1].pkbuf; ogs_assert(pkbuf); - if (ogs_gtp_sendto(xact->gnode, pkbuf) != OGS_OK) { - ogs_error("ogs_gtp_sendto() failed"); - ogs_gtp_xact_delete(xact); - return OGS_ERROR; - } + ogs_expect(OGS_OK == ogs_gtp_sendto(xact->gnode, pkbuf)); return OGS_OK; } @@ -761,10 +754,7 @@ static void response_timeout(void *data) pkbuf = xact->seq[xact->step-1].pkbuf; ogs_assert(pkbuf); - if (ogs_gtp_sendto(xact->gnode, pkbuf) != OGS_OK) { - ogs_error("ogs_gtp_sendto() failed"); - goto out; - } + ogs_expect(OGS_OK == ogs_gtp_sendto(xact->gnode, pkbuf)); } else { ogs_warn("[%d] %s No Reponse. Give up! " "for step %d type %d peer [%s]:%d", @@ -779,11 +769,6 @@ static void response_timeout(void *data) ogs_gtp_xact_delete(xact); } - - return; - -out: - ogs_gtp_xact_delete(xact); } static void holding_timeout(void *data) diff --git a/lib/pfcp/xact.c b/lib/pfcp/xact.c index 1436d76e7..fc1337100 100644 --- a/lib/pfcp/xact.c +++ b/lib/pfcp/xact.c @@ -286,7 +286,6 @@ int ogs_pfcp_xact_update_tx(ogs_pfcp_xact_t *xact, static int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type) { - int rv = OGS_OK; char buf[OGS_ADDRSTRLEN]; ogs_pfcp_xact_stage_t stage; @@ -330,8 +329,7 @@ static int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type) OGS_ADDR(&xact->node->addr, buf), OGS_PORT(&xact->node->addr)); - rv = ogs_pfcp_sendto(xact->node, pkbuf); - ogs_expect(rv == OGS_OK); + ogs_expect(OGS_OK == ogs_pfcp_sendto(xact->node, pkbuf)); } else { ogs_warn("[%d] %s Request Duplicated. Discard!" " for step %d type %d peer [%s]:%d", @@ -396,8 +394,7 @@ static int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type) OGS_ADDR(&xact->node->addr, buf), OGS_PORT(&xact->node->addr)); - rv = ogs_pfcp_sendto(xact->node, pkbuf); - ogs_expect(rv == OGS_OK); + ogs_expect(OGS_OK == ogs_pfcp_sendto(xact->node, pkbuf)); } else { ogs_warn("[%d] %s Request Duplicated. Discard!" " for step %d type %d peer [%s]:%d", @@ -561,9 +558,7 @@ int ogs_pfcp_xact_commit(ogs_pfcp_xact_t *xact) pkbuf = xact->seq[xact->step-1].pkbuf; ogs_assert(pkbuf); - if (ogs_pfcp_sendto(xact->node, pkbuf) != OGS_OK) { - ogs_error("ogs_pfcp_sendto() failed"); - } + ogs_expect(OGS_OK == ogs_pfcp_sendto(xact->node, pkbuf)); return OGS_OK; } @@ -603,9 +598,7 @@ static void response_timeout(void *data) pkbuf = xact->seq[xact->step-1].pkbuf; ogs_assert(pkbuf); - if (ogs_pfcp_sendto(xact->node, pkbuf) != OGS_OK) { - ogs_error("ogs_pfcp_sendto() failed"); - } + ogs_expect(OGS_OK == ogs_pfcp_sendto(xact->node, pkbuf)); } else { ogs_warn("[%d] %s No Reponse. Give up! " "for step %d type %d peer [%s]:%d", @@ -620,8 +613,6 @@ static void response_timeout(void *data) ogs_pfcp_xact_delete(xact); } - - return; } static void holding_timeout(void *data)