New patch for qt-copy: fix QSslSocket::waitForBytesWritten(-1)

Andreas Hartmetz ahartmetz at
Sun Nov 18 04:27:12 GMT 2007


During my work on a replacement for KSSL I discovered a bug in QSslSocket. 
After much trial and error I realized that while QSslSocket::bytesToWrite() 
may not be perfectly reliable, it is also unnecessary if 
waitForBytesWritten(-1) works right.
The patch fixes the bug that QSslSocket::waitForBytesWritten(-1) does the same 
thing as waitForBytesWritten(0). What should happen for -1 is that it waits 
until some data (in the actual implementation, all data) has been transferred 
to the OS socket. For 0, it just waits for zero milliseconds.
The bug only triggers when using an encrypted connection.
The fix is to make the timeout behavior of QSslSocket imitate that of 
QAbstractSocket, and by imitate I mean use the same code.
It's a small change that /looks/ harmless.
Thiago had a quick look and approved of the fix, although he (just like me) 
probably didn't do a full investigation; the socket code consists of many 
interacting classes...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0200-fix-qsslsocket-waitfor.diff
Type: text/x-diff
Size: 1707 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list