From 57d3c4698c9209700a49f03c3700660d34615bc8 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 30 May 2018 23:00:13 +0200 Subject: [PATCH] gcoap: don't drop observer on re-register With #9209 gCoAP got the ability to re-register and OBSERVE with a new token, sadly the `observer` variable wasn't set in that fix, so a re-registration actually led to the deletion of the observer (because it is still `NULL` when the old registration is overwritten in l. 317) --- sys/net/application_layer/gcoap/gcoap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index e9cb4ed7d7..a62db3b102 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -291,6 +291,7 @@ static size_t _handle_req(coap_pkt_t *pdu, uint8_t *buf, size_t len, && _endpoints_equal(remote, resource_memo->observer)) { /* observer re-registering with new token */ memo = resource_memo; + observer = resource_memo->observer; } else if ((empty_slot >= 0) && (resource_memo == NULL)) { int obs_slot = _find_observer(&observer, remote);