-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite #13
Rewrite #13
Conversation
The bridge can now handle connections/disconnections gracefully, though it does not handle its own shutdown properly yet. Additionally, Ryder device output is now read as it is received instead of assuming that it follows a command.
Unfortunately I cannot run the branch as-is. % cargo build
Compiling ryder-bridge-rust v0.1.0 (.../ryder-bridge-rust)
error[E0599]: no method named `is_finished` found for struct `tokio::task::JoinHandle` in the current scope
--> src/main.rs:272:37
|
272 | if !conn.handle.is_finished() {
| ^^^^^^^^^^^ method not found in `tokio::task::JoinHandle<()>`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `ryder-bridge-rust` due to previous error
warning: build failed, waiting for other jobs to finish... |
Strange, that function doesn't seem to be platform-specific, so I'm not sure why it doesn't exist for you. Either way, that part of the code was kind of a mess and has been redone entirely. Could you try compiling it again? |
Builds fine now! The next issue seems to be the "Not a typewriter" bug. I ran into it before and it has something to do with a particular serial function when used on macOS. I do not know if this is the same issue, but in that case the fix was to set the baud rate to In any case, the bug occurs only when using the simulator and not the physical device. Arguably it could also be a problem in the simulator firmware and it the virtual serial port needs a flag set by the simulator.
|
The bridge uses |
Alright, it should work now. |
The information contained in the error is unreliable due to the same error kinds being returned in several situations, such as `NotFound` being used to represent both a busy device and a non-existent one. Therefore, no specific errors can be provided to clients.
…ndows This kind of failure still happens occasionally, but is a lot rarer now.
This is good to go pending reviews @MarvinJanssen @friedger. |
Works great on my m1 Mac! However, tests seem to fail. Looks like it's trying to use an address/port that is in use. Any idea how we could make that mock more resilient on different systems? At some point we'll be running
|
The test runner uses multiple threads by default, which does not work when all the tests use the same port. The tests must be run with |
The more you know! Works great, good to merge for me. @friedger? |
I'm merging this because it has been open for a while @friedger. |
This rewrites most of the code and brings the bridge to a more functional state. The main additions are:
Remaining features to implement:
RESPONSE_WAIT_IN_QUEUE
and laterRESPONSE_BEING_SERVED
when the device becomes available. This will fix Bridge cannot handle multiple incoming WebSocket connections #10.The asynctokio_serial
interface should be used more fully. Currently, the sync interface is being used without issue, but the code could probably be made cleaner with more futures rather than threads.tokio_serial
has issues with re-opening the serial port, and its async interface cannot detect device disconnections (On FreeBSD tokio-serial seems not to notice, that port is (physically) removed during wait for inbound data berkowski/tokio-serial#56).