18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 21:24:58 +01:00
Files
maszyna/tests/unit/CMakeLists.txt
maj00r 988c0af589 fix(editor): the closing doesn't wait for a geoportal service that doesn't answer (#432)
* fix(editor): the closing doesn't wait for a geoportal service that doesn't answer

When geoportal.gov.pl took the connection and never answered, the
editor's closing stood still for tens of seconds and was killed: the
WinHTTP client was synchronous and looked at the stop only between the
reads of a body, so a request waiting for the answer held the closing
for the timeouts (up to 20 s for the answer, a few tries a square),
and the map of the place-picker downloaded with no stop at all, its
std::async future waited for to the end.

On Windows the client now uses WinHTTP asynchronously: each step is
waited for while the stop is looked at every 50 ms, and a stop closes
the request at once. The timeouts, the user agent, the size limit, the
errors and the body of a response with an error status stay as they
were. The map of the place-picker is given up when it goes. libcurl
looked at the stop during the whole transfer already.

The unit tests run the client against a local server that never
answers (given up within 0.4 s of the stop), one with a body of
100 kB and one with an error status.

* fix(editor): the capabilities of a WMS service being added don't hold the closing either

The reading of the layers of a WMS service the user adds ran on a
std::async future of the editor with no stop: closing the editor while
such a service didn't answer waited for its three tries. The reading
is given up when the editor goes, as the other downloads now are, and
editor_http_get, left with no callers, goes.

The unit test's silent server no longer waits for the client to close
its connection, and the requests to the local server are skipped when
the environment names a proxy, which couldn't reach it.

* fix(editor): the stop of the WMS reading outlives the future waiting for it

The flag was declared after the future of the reading, so it was
destroyed first while the future's destructor still waited for the
task reading it.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-21 10:40:07 +01:00

3.3 KiB