-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix blocking receiver sleeping after every read (#48)
Currently, the `ws_receiver_blocking` function would always sleep after every read. Additionally, it did not use the value from `options.delay_blocking` for the sleep delay. This would result in that thread being blocked for 10ms _after every read_ no matter what the user configured it to, meaning it would receive data at an unnecessarily slow rate. In this PR: - Instead of using `set_nonblocking` or calling `std::thread::sleep` after every read, we now use `set_read_timeout` in the non-tokio native impls. - The `delay_blocking` option is removed in favor of `read_timeout` - The default for `read_timeout` is `Some(10ms)` - The ideal thing to do here would be to not block at all and instead use native polling APIs. This work is left as a TODO for another PR. - #49
- Loading branch information
Showing
3 changed files
with
92 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//! Example application. | ||
mod app; | ||
pub use app::ExampleApp; | ||
|
||
|