Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with lwip, until function coap_new_endpoint return, 'result' is not assigned to context->endpoint #334

Closed
luminais opened this issue Apr 15, 2019 · 3 comments

Comments

@luminais
Copy link

libcoap/src/net.c

Lines 472 to 477 in 1d48484

if (listen_addr) {
coap_endpoint_t *endpoint = coap_new_endpoint(c, listen_addr, COAP_PROTO_UDP);
if (endpoint == NULL) {
goto onerror;
}
}

libcoap/src/coap_io_lwip.c

Lines 105 to 128 in 1d48484

coap_new_endpoint(coap_context_t *context, const coap_address_t *addr, coap_proto_t proto) {
coap_endpoint_t *result;
err_t err;
LWIP_ASSERT("Proto not supported for LWIP endpoints", proto == COAP_PROTO_UDP);
result = coap_malloc_type(COAP_ENDPOINT, sizeof(coap_endpoint_t));
if (!result) return NULL;
result->sock.pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
if (result->sock.pcb == NULL) goto error;
udp_recv(result->sock.pcb, coap_recv, (void*)result);
err = udp_bind(result->sock.pcb, &addr->addr, addr->port);
if (err) {
udp_remove(result->sock.pcb);
goto error;
}
result->default_mtu = COAP_DEFAULT_MTU;
result->context = context;
result->proto = proto;
return result;

@obgm
Copy link
Owner

obgm commented Sep 2, 2019

You are right, this is indeed missing.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Jul 23, 2022

libcoap LwIP support has been re-written in PR #884, and so this should no longer be an issue as the standard coap_new_endpoint() function is now used.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 10, 2022

Fixed in #939.

@mrdeep1 mrdeep1 closed this as completed Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants