Closed jrobsonchase closed 6 years ago
@Pursuit92 That is an unfortunate drawback of the current design. Previously I was cloning TcpStream
and using it across 2 different threads (one for n/w reads coz read call is blocking). This worked well for Non-TLS but once TLS came into picture, the design was wrong
https://github.com/sfackler/rust-openssl/issues/445 https://github.com/sfackler/rust-openssl/issues/325 https://github.com/sfackler/rust-openssl/issues/338
Good news is that I've plans to migrate this to use tokio-core (once there is a 0.2 release on crates.io coz mqtt requires recurring timeouts for pings) very soon and this wouldn't be a problem.
Current write limit is hard coded to 1000 publishes/sec. I can add this to config but it wouldn't make any sense after migrating to tokio-core. I can finish this much faster if I get some help :)
I'd love to help, but I'm still working on getting my head around futures for my own purposes. I'll see if I can pitch in once I'm a bit more comfortable with them :smile:
Should be fixed in tokio2 branch
It appears that the call to
connection.stream.set_read_timeout
with the argument of 1 second is causing all publishes to only occur at the second boundary since thewrite
call only happens after aTimedOut
or aWouldBlock
in thereceive
loop. It looks like the problem started in https://github.com/Ather-Energy/RuMqtt/commit/1fe12f46031b1c9ad7e9e02af37dd4dddcbfc152.