plgd-dev / go-coap

Implementation of CoAP Server & Client in Go

Home Page:https://coap.technology

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to cancel Observe on Context Deadline Exceeded?

andersroos opened this issue · comments

Hi!

I have a situation where I do Observe and the request reaches the server and then ack reaches the client. But the notifications after don't reach the client (because of connectivity issues due to having a moving server). In this case the Observe call will hang until the context I provided times out. So I get an error from the Observe, but in that' case it doesn't return the Observation.

So later when connectivity is restored and the callback is called with notifications I can't cancel it because Observe never returned the Observation.

Would it be possible to return the Observation here and possibly here? Or would that have some negative side effects?

If this is a viable solution I can make a PR.

When investigating this deeper I see that it is in fact cleaned up on error. I don't really understand what is going on in my case then. Will continue my investigation, closing this meanwhile as I don't know what is going on.