Workaround for bluetooth payload transfer bugs
AbandonedPublic

Authored by mtijink on Dec 28 2018, 6:47 PM.

Details

Reviewers
None
Group Reviewers
KDE Connect
Summary

On both devices I tested, the bluetooth InputStream did not notice end-of-stream and thus the transfer hanged.

Using this workaround, if we know the size of the payload, we notice this condition and prevent reading too much.

If this happens on all devices, we could possibly cancel the transfer immediately instead of only logging.

Test Plan

Transferring files or media art now works correctly.

Diff Detail

Repository
R225 KDE Connect - Android application
Branch
bluetooth-android-download-workaround
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6416
Build 6434: arc lint + arc unit
mtijink created this revision.Dec 28 2018, 6:47 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptDec 28 2018, 6:47 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
mtijink requested review of this revision.Dec 28 2018, 6:47 PM

Actually, wait a bit before reviewing this. It turns out that not all (Android) devices support multiple Rfcomm servers (currently used for transmitting payloads), so we'll need something for that too.

I'm thinking about some kind of multiplexing thing, I'll get back about that.

sarcot added a subscriber: sarcot.Dec 29 2018, 9:38 PM

Just so you know, I initially had the payload transfer going over the existing bluetooth connection (by sending the payload transfer info followed by the payload itself), but if the payload had newline characters, then the processing got messed up (because newlines got stripped off as part of regular message processing). Also, with payloads of unknown lengths, it wouldn't be easily possible to determine the end of the payload. Therefore, I split it out to a separate connection.

Just so you know, I initially had the payload transfer going over the existing bluetooth connection (by sending the payload transfer info followed by the payload itself), but if the payload had newline characters, then the processing got messed up (because newlines got stripped off as part of regular message processing). Also, with payloads of unknown lengths, it wouldn't be easily possible to determine the end of the payload. Therefore, I split it out to a separate connection.

Makes sense. Sending it directly also causes problems for long transfers (e.g. file shares), so separating them makes sense. I'm trying to make something work in all cases.

mtijink abandoned this revision.Mar 8 2019, 9:29 PM

Superseded by connection multiplexer work (see KDE Invent).