Closed tekjar closed 6 years ago
Ok I think there is no problem with this. I was testing this with aws iot and it doesn't seem to support persistent sessions (and I don't know how to check the reason for disconnection on aws). Tls is working for me locally.
@nanomad I think this is a different issue. I'll verify this.
@tekjar You can use the free plan on CloudMQTT to test it.
I've configured it using the following as the CA cert bundle:
"C:\OpenSSL-Win64\certs\cacert.pem"
@nanomad
This is happening because Framed
is not able to continue after handling bounded streams
Ah, makes sense. I'll work on it a little bit. It's a good way of learning about tokio2 anyway
So, after looking at https://github.com/alexcrichton/futures-rs/issues/462 it seems like both stream's join as well as sink's send_all flush and close the sink at the end which is no bueno.
I suppose the solution is to iterate over the packets sending them one by one. I'll see what I can come up...
@tekjar Should be fixed in #67 Took me way too much than I care to admit to figure out how to write the loop properly
@tekjar I think I found it.
I have no idea why it wasn't working as I'm not even a tokio newbie but something was going wrong in republish_unacked of connection.rs when publishes was an Vec of len 0. Making handle_reconnection return a None in that case fixes the issue.
I've added a test case as well