D6730: Determine which IP address to use for sshfs

Aleix Pol Gonzalez noreply at phabricator.kde.org
Wed Jul 19 00:52:13 UTC 2017


apol added a comment.


  In general, this looks like an overkill to me.
  Maybe it would make sense to allow the `DeviceLink` to tell which IP it's connected to?

INLINE COMMENTS

> mounter.cpp:105
> +    QString port = np.get<QString>(QStringLiteral("port"));
> +    QString ipAddress = "";
> +    QTcpSocket socket;

No need to initialize with "". Just leave `QString ipAddress;`.

> mounter.cpp:110
> +        socket.connectToHost(a, port.toUShort());
> +        if (socket.waitForConnected(500)) {
> +            ipAddress = a;

We should at least parallelize the connectToHost. i.e. connect them all and then wait them all.

> mounter.cpp:118
> +
> +    if (ipAddress == "") {
> +        qCDebug(KDECONNECT_PLUGIN_SFTP) << "Couldn't find an IP address with port" << port << "open";

`if (ipAddress.isEmpty()) {`

Says more things and doesn't need to construct a `QString("")`

REPOSITORY
  R224 KDE Connect

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

To: jeanv, #kde_connect
Cc: apol, nicolasfella, sredman, tfella, aboudhar, seebauer, progwolff, MayeulC, menasshock, ach, hkaelberer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20170719/e892e4d9/attachment.html>


More information about the KDEConnect mailing list