KTcpSocket + errorString()

Thiago Macieira thiago at kde.org
Sun Sep 13 08:22:30 BST 2009


Em Domingo 13. Setembro 2009, às 00.31.58, Martin Koller escreveu:
> Hi,
> 
> I'm looking into the problem why a kio (POP, IMAP) slave connectToHost /
> waitForConnected() and having no connect (==timeout) always shows "Unknown
> Error" in the Error Dialog, whereby QTcpSocket has a SocketTimeoutError in
> that case.
> 
> The problem seems to be due to KTcpSocket internally having another Socket
> class, but being itself an QIODevice but not synchronizing the errorString
> between its socket and itself.
> 
> Is the proposed patch ok ?

Yes. Please commit.


> Index: ktcpsocket.cpp
> ===================================================================
> --- ktcpsocket.cpp      (Revision 1020053)
> +++ ktcpsocket.cpp      (Arbeitskopie)
> @@ -612,6 +612,8 @@
>  bool KTcpSocket::waitForConnected(int msecs)
>  {
>      bool ret = d->sock.waitForConnected(msecs);
> +    if (!ret)
> +        setErrorString(d->sock.errorString());
>      setOpenMode(d->sock.openMode() | QIODevice::Unbuffered);
>      return ret;
>  }
> @@ -620,6 +622,8 @@
>  bool KTcpSocket::waitForDisconnected(int msecs)
>  {
>      bool ret = d->sock.waitForDisconnected(msecs);
> +    if (!ret)
> +        setErrorString(d->sock.errorString());
>      setOpenMode(d->sock.openMode() | QIODevice::Unbuffered);
>      return ret;
>  }
> 

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090913/233b9eb2/attachment.sig>


More information about the kde-core-devel mailing list