Closed mhaberler closed 3 weeks ago
You're doing everything right, it looks like there's a bug somewhere. Calling publish.send() should release a lock, but apparently it doesn't.
The mutexes branch has quick and dirty changes mainly for debugging, I haven't tested it much.
Still, I'll have a look to see if this can be fixed easily.
Oh I just realized what it could be!
Iirc the internal lock is released when the publish object is destroyed. Here it's still in scope when you're calling begin_publish for the second time.
Try surrounding the first block of code in curly braces. This way publish will be destroyed earlier.
ah, comprende, makes sense - will report.
confirmed to work with your suggestion.
given the following code is called from
loop()
using themutexes
branch:if I uncomment the commented code, the server deadlocks in
mqtt.begin_publish
doing a plain
mqtt.publish()
twice in a row works fineAm I doing something wrong? how would I properly do this?
thanks in advance
Michael