MCPcopy Create free account
hub / github.com/SFML/SFML / waitForOperationComplete

Method waitForOperationComplete

src/SFML/Network/Sftp.cpp:358–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356
357 template <typename Callable>
358 int waitForOperationComplete(const Callable& operation, const sf::TimeoutWithPredicate& timeout)
359 {
360 while (true)
361 {
362 if (const auto result = operation(); result != LIBSSH2_ERROR_EAGAIN)
363 return result; // Operation completed without having to block
364
365 // Wait for socket to become ready
366 const auto directions = libssh2_session_block_directions(ssh2Session.get());
367 if (directions == (LIBSSH2_SESSION_BLOCK_INBOUND | LIBSSH2_SESSION_BLOCK_OUTBOUND))
368 {
369 if (selectorEither.wait(timeout.getPeriod()))
370 continue;
371 }
372 else if (directions == LIBSSH2_SESSION_BLOCK_OUTBOUND)
373 {
374 if (selectorSend.wait(timeout.getPeriod()))
375 continue;
376 }
377 else
378 {
379 if (selectorRecv.wait(timeout.getPeriod()))
380 continue;
381 }
382
383 if (!timeout.getPredicate()())
384 return LIBSSH2_ERROR_EAGAIN; // Gave up waiting
385 }
386 }
387
388 Sftp::Result initializeSftp(const TimeoutWithPredicate& timeout)
389 {

Callers 12

connectMethod · 0.80
disconnectMethod · 0.80
loginMethod · 0.80
resolvePathMethod · 0.80
getAttributesMethod · 0.80
getDirectoryListingMethod · 0.80
createDirectoryMethod · 0.80
deleteDirectoryMethod · 0.80
renameMethod · 0.80
deleteFileMethod · 0.80
downloadMethod · 0.80
uploadMethod · 0.80

Calls 2

getMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected