Crash when using python aiocoap
sheosi opened this issue · 2 comments
sheosi commented
I'm experimenting and when this as a server and Python's aiocoap as a client I get a crash:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/sergio/.cargo/registry/src/github.com-1ecc6299db9ec823/coap-0.11.3/src/observer.rs:85:59
import asyncio
from aiocoap import *
async def main():
protocol = await Context.create_client_context()
request = Message(code=GET, uri='coap://127.0.0.1:5683/hello/put', observe=0)
pr = protocol.request(request)
r = await pr.response
print("First response: %s\n%r"%(r, r.payload))
if __name__ == "__main__":
asyncio.run(main())
Changing the "observe" flag to something other than 0 doesn't crash, however, the resource is not observed.
EDIT: On second thought this looks more like an issue in coap-lite
isn't it?
sheosi commented
Using version from git and updating to coap-lite
fixed the crash.
wuyingfengsui commented
I will use the latest coap-lite
in the next release.