Skip to content

Commit

Permalink
gcoap_forward_proxy: make use of coap_request_ctx_get_remote_udp()
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Sep 2, 2022
1 parent 45924c4 commit 628edcc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sys/net/application_layer/gcoap/forward_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 1 addition & 8 deletions sys/net/application_layer/gcoap/gcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 628edcc

Please sign in to comment.