mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
nanocoap_sock: add local information to coap_request_ctx_t
This commit is contained in:
parent
c280076594
commit
330a6cfb91
@ -338,6 +338,9 @@ void coap_request_ctx_init(coap_request_ctx_t *ctx, sock_udp_ep_t *remote);
|
||||
struct _coap_request_ctx {
|
||||
const coap_resource_t *resource; /**< resource of the request */
|
||||
sock_udp_ep_t *remote; /**< remote endpoint of the request */
|
||||
#if defined(MODULE_SOCK_AUX_LOCAL) || DOXYGEN
|
||||
sock_udp_ep_t *local; /**< local endpoint of the request */
|
||||
#endif
|
||||
#if defined(MODULE_GCOAP) || DOXYGEN
|
||||
/**
|
||||
* @brief transport the packet was received over
|
||||
|
@ -825,10 +825,6 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
|
||||
DEBUG("nanocoap: error parsing packet\n");
|
||||
continue;
|
||||
}
|
||||
if ((res = coap_handle_req(&pkt, buf, bufsize, &ctx)) <= 0) {
|
||||
DEBUG("nanocoap: error handling request %" PRIdSIZE "\n", res);
|
||||
continue;
|
||||
}
|
||||
|
||||
sock_udp_aux_tx_t *aux_out_ptr = NULL;
|
||||
#ifdef MODULE_SOCK_AUX_LOCAL
|
||||
@ -841,7 +837,13 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
|
||||
if (!sock_udp_ep_is_multicast(&aux_in.local)) {
|
||||
aux_out_ptr = &aux_out;
|
||||
}
|
||||
ctx.local = &aux_in.local;
|
||||
#endif
|
||||
if ((res = coap_handle_req(&pkt, buf, bufsize, &ctx)) <= 0) {
|
||||
DEBUG("nanocoap: error handling request %" PRIdSIZE "\n", res);
|
||||
continue;
|
||||
}
|
||||
|
||||
sock_udp_send_aux(&sock.udp, buf, res, &remote, aux_out_ptr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user