kio_http: fix waiting until the cache cleaner listens to the socket.

Review Request #126865 - Created Jan. 23, 2016 and submitted

Information
David Faure
kio
master
d9a2ecc...
Reviewers
kdeframeworks
ahartmetz
The old code was doing connectToServer+waitForConnected, but this
fails immediately if connectToServer sets an error like QLocalSocket::ConnectionRefusedError.
waitForConnected() is only meaningful if we are in ConnectingState.

We do have to try multiple times (no way to wait until precisely
the time when it start listening), but not using waitForConnected,
so I used msleep(100) in the loop instead.

I could have used DBus activation of course (to block until it's ready),
but I assume DBus is not wanted here since that's not what's used for
communication in the first place.

Change-Id: Ib9ee4699a44daa3016a72a24c6e816b940e1ed5c

kill kio_http_cache_cleaner; run unittest using KIO::get; watch kio_http output.

Before:
HTTPProtocol::sendCacheCleanerCommand: Could not connect to cache cleaner, not updating stats of this cache file.

After:
HTTPProtocol::sendCacheCleanerCommand: Successfully connected to cache cleaner.

Andreas Hartmetz
David Faure
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted to kio master in 7f28475 (with a typo in the REVIEW number...)

Loading...