Skip to content
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

Migrate to Actix 0.13 APIs, Tokio 1.x, and fix non-UTF-8 messages being dropped silently #32

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mologie
Copy link

@mologie mologie commented May 8, 2023

This PR updates dependencies (see Cargo.toml) and resolves an issue where LinesCodec's decoder would return an error for non-UTF-8 message payloads, and Actix would silently drop the message in response. It is not backwards-compatible with the currently release version 0.4 due to Actix and Tokio being backwards-incompatible.

The following and comparable messages where stations used a name encoded with CP 1252 would be dropped:

|464e5446 43393030 323e4f47 4e464e54| FNTFC9002>OGNFNT 00000000
|2c714153 2c475853 74477267 6e3a3e31| ,qAS,GXStGrgn:>1 00000010
|31313031 3768204e 616d653d 2257696e| 11017h Name="Win 00000020
|643a46fc 7273742d 53fc6422 20362e36| d:F.rst-S.d" 6.6 00000030
|6442|                                dB               00000040
                                                       00000042

The cause was that ü encodes to 0xFC under CP 1252, which results in Rust's str::from_utf8 to fail validation in LinesCodec, and old Actix versions would silently discard the error without stopping the affected actor. I noticed this because new Actix versions actually do stop the actor. This PR also adds code to log other I/O errors before the actor is stopped.

Steps to reproduce: Run cargo run --example connect | grep 'Name=' on this branch vs. master, and observe that after a few minutes Wind:Fürst-Süd has several status lines in the output of this branch, versus none in master.

Periodic keepalives are not informative to the administrator. They are
always sent, and an info message notifies about reconnect events.
Some stations encode their name using UTF-8, others use CP 1252 for
German umlauts. This normalizes station names to UTF-8 within the
codec layer. I have not observed odd encodings outside of names.

Also uses \r\n as message separator now since this ships with its own
codec anyway, and that's the technically correct thing to do as per
documentation on the GliderNet Wiki.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant