From 628edcc1c91c4e7ec7844a4dd28d30e4774fd995 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 2 Sep 2022 13:34:50 +0200 Subject: [PATCH] gcoap_forward_proxy: make use of coap_request_ctx_get_remote_udp() --- sys/net/application_layer/gcoap/forward_proxy.c | 2 +- sys/net/application_layer/gcoap/gcoap.c | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/net/application_layer/gcoap/forward_proxy.c b/sys/net/application_layer/gcoap/forward_proxy.c index 5beb91567063..d7aad7c590af 100644 --- a/sys/net/application_layer/gcoap/forward_proxy.c +++ b/sys/net/application_layer/gcoap/forward_proxy.c @@ -102,7 +102,7 @@ static ssize_t _forward_proxy_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len, coap_request_ctx_t *ctx) { int pdu_len; - sock_udp_ep_t *remote = coap_request_ctx_get_context(ctx); + sock_udp_ep_t *remote = coap_request_ctx_get_remote_udp(ctx); pdu_len = gcoap_forward_proxy_request_process(pdu, remote); diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 6550ece75590..7c52160abf03 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -706,21 +706,14 @@ static size_t _handle_req(gcoap_socket_t *sock, coap_pkt_t *pdu, uint8_t *buf, } ssize_t pdu_len; - char *offset; coap_request_ctx_t ctx = { .resource = resource, + .context = resource->context, .tl_type = (uint32_t)sock->type, .remote = remote, }; - if (coap_get_proxy_uri(pdu, &offset) > 0) { - ctx.context = remote; - } - else { - ctx.context = resource->context; - } - pdu_len = resource->handler(pdu, buf, len, &ctx); if (pdu_len < 0) { pdu_len = gcoap_response(pdu, buf, len,