Make bluetooth payload upload work & asynchronous
ClosedPublic

Authored by mtijink on Apr 16 2018, 8:18 PM.

Details

Summary

Sharing files to the Android bluetooth backend now works. The code is asynchronous now too.

Test Plan

I tested several files, and they all get transferred correctly. The socket gets destroyed correctly too.

Diff Detail

Repository
R224 KDE Connect
Branch
bluetooth-fix-upload
Lint
No Linters Available
Unit
No Unit Test Coverage
mtijink created this revision.Apr 16 2018, 8:18 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptApr 16 2018, 8:18 PM
mtijink requested review of this revision.Apr 16 2018, 8:18 PM
apol requested changes to this revision.Apr 17 2018, 11:36 AM
apol added a subscriber: apol.

Small observations, looks really good!

core/backends/bluetooth/bluetoothuploadjob.cpp
56 ↗(On Diff #32332)

Can you use the new syntax?

82 ↗(On Diff #32332)

qMin<qint64>() reads better imho, then you can drop the ugly cast.

96 ↗(On Diff #32332)

remove this debug? call finishWrites() directly?

107 ↗(On Diff #32332)

If it didn't end we leak?

This revision now requires changes to proceed.Apr 17 2018, 11:36 AM
mtijink updated this revision to Diff 32405.Apr 17 2018, 4:58 PM

Make some requested changes, and better error handling

mtijink marked 3 inline comments as done.Apr 17 2018, 5:01 PM

I'll do some more testing with the current changes, to make sure edge cases are handled correctly.

core/backends/bluetooth/bluetoothuploadjob.cpp
107 ↗(On Diff #32332)

We'll get called again if more bytes are written, so it eventually either disconnects (when some error happens) or all bytes have been written. Either case, we'll close it and destroy the job.

apol accepted this revision.Apr 17 2018, 10:56 PM

Looks good to me, definitely a step forward.

core/backends/bluetooth/bluetoothuploadjob.cpp
109

Just connect to closeConnection, let's not add cruft, makes for readability.

This revision is now accepted and ready to land.Apr 17 2018, 10:56 PM
This revision was automatically updated to reflect the committed changes.