Review Request 127501: Improve TCPSlaveBase::isConnected

Andreas Hartmetz ahartmetz at gmail.com
Sat Mar 26 18:54:58 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127501/#review94033
-----------------------------------------------------------



Ow. That's a pretty bad problem.
I suggest a less intrusive (code churn and regression potential) solution: Since QAbstractSocket *does* have setError() as a protected method, you can still call it:

// never instantiated
class QAbstractSocketHack: public QAbstractSocket {
public:
    void setError(SocketError e) Q_DECL_OVERRIDE { QAbstractSocket::setError(e); }
};

// in socket reset code
static_cast<QAbstractSocketHack *>(&d->socket)->setError(QAbstractSocket::UnknownSocketError);

- Andreas Hartmetz


On March 26, 2016, 5:29 p.m., Albert Astals Cid wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127501/
> -----------------------------------------------------------
> 
> (Updated March 26, 2016, 5:29 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> Qt sockets returns ConnectedState even when error is set to RemoteHostClosedError after a write operation.
> 
> So make ::isConnected also check for RemoteHostClosedError.
> 
> This has the consequence that we have to create/delete the socket since Qt sockets have no way to reset their error state so if we want to reuse the slave to connect again it will never work with the same socket since it will always say RemoteHostClosedError.
> 
> I need this for https://git.reviewboard.kde.org/r/127502/
> 
> 
> Diffs
> -----
> 
>   src/core/tcpslavebase.cpp b9be69d 
> 
> Diff: https://git.reviewboard.kde.org/r/127501/diff/
> 
> 
> Testing
> -------
> 
> Seesms to work fine and the pop3 bugfix i have also works fine.
> 
> 
> Thanks,
> 
> Albert Astals Cid
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160326/232dc3bf/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list