mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gcoap_forward_proxy: make use of coap_request_ctx_get_remote_udp()
This commit is contained in:
parent
2376343547
commit
f068fbccb6
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user