D12264: Make bluetooth payload upload work & asynchronous

Aleix Pol Gonzalez noreply at phabricator.kde.org
Tue Apr 17 11:36:36 UTC 2018


apol requested changes to this revision.
apol added a comment.
This revision now requires changes to proceed.


  Small observations, looks really good!

INLINE COMMENTS

> bluetoothuploadjob.cpp:56
> +    Q_ASSERT(m_socket);
> +    connect(m_socket, SIGNAL(disconnected()), m_socket, SLOT(deleteLater()));
>  

Can you use the new syntax?

> bluetoothuploadjob.cpp:82
> +    while (m_socket->bytesToWrite() == 0 && mData->bytesAvailable() && m_socket->isWritable()) {
>          qint64 bytes = qMin(mData->bytesAvailable(), (qint64)4096);
> +        int bytesWritten = m_socket->write(mData->read(bytes));

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

> bluetoothuploadjob.cpp:96
> +        if (errorOccurred || m_socket->bytesToWrite() == 0) {
> +            qDebug() << "Immediate delete";
> +            m_socket->close();

remove this debug? call finishWrites() directly?

> bluetoothuploadjob.cpp:107
> +    Q_ASSERT(m_socket);
> +    if (m_socket->bytesToWrite() == 0) {
> +        m_socket->close();

If it didn't end we leak?

REPOSITORY
  R224 KDE Connect

REVISION DETAIL
  https://phabricator.kde.org/D12264

To: mtijink, #kde_connect, apol
Cc: apol, #kde_connect, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, ahmedbesbes, ndavis, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, ach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20180417/45c2b201/attachment.html>


More information about the KDEConnect mailing list