[Qt-interest] QSslSocket: massive difference in app memory usage when encryption enabled

Markus Goetz Markus.Goetz at nokia.com
Thu Oct 15 12:49:13 CEST 2009


ext Stephen Collyer wrote:
> 2009/10/14 Markus Goetz <Markus.Goetz at nokia.com 
> <mailto:Markus.Goetz at nokia.com>>
>
>     ext Stephen Collyer wrote:
>
>
>     1. With a QSslSocket, you'd have to check encryptedBytesToWrite()
>     since those are the bytes going out on the actual TCP socket. So,
>     to be on the safe side do check for (encryptedBytesToWrite() +
>     bytesToWrite() < http_socket_buffer_length_)
>
>
> Thanks for the response. I'll try your suggested changes and let you 
> know what happens.
>
> There's one point that I'm not clear about: I use QSslSocket in both 
> encrypted and unencrypted mode, and I only see the problem with 
> encrypted mode. So I need a solution that works in both cases. 
> However, I assume that encryptedBytesWritten() is only emitted for a 
> QSslSocket in encrypted mode - if so, I guess I'd need an ugly hack to 
> connect the encryptedBytesWritten() or bytesWritten() based on whether 
> the socket is encrypted or not.

Hm, you can do it like that, yes. But I'd go for what I proposed. Since 
you are checking the buffer fill anyway and only writing when they are 
less than a certain size, you can just try to do it for both signals, it 
should work:)

Markus



More information about the Qt-interest-old mailing list