Comment 8 for bug 1261683

Revision history for this message
Roger Light (roger.light) wrote :

My point is that if you set run=1 before each call to publish(), then wait for that publish to complete before doing anything else (which is what you want), then it will work fine (assuming the broker doesn't disconnect etc).

If an earlier call to publish() can have an effect on the run variable for a subsequent publish, then you obviously didn't use a blocking publish in the first case.

Another way to achieve a similar effect would be to store the mid of the blocking message, then compare it to the highest mid sent out (by using the on_publish callback). If my mid is 1 and the highest sent mid is 2, then my message has sent. You'd have to deal with mid wraparound as well of course.