sftp aio: Fix hanging in case of unordered waits

Based on discussion done in this comment: !383 (comment 1515292675)

This MR changes the way in which receiving sftp responses is handled.

The old way polled/blocked on the channel before checking the sftp response queue which could cause infinite waiting by default if the required response is already present in the response queue and no other sftp response is ever sent by the server.

Reported by @jjelen's work which uses the async aio API for ansible/pylibssh (https://github.com/ansible/pylibssh/pull/641)

(Proved by the test failure https://gitlab.com/eshankelkar/libssh-mirror-eshan/-/jobs/7805553460)

The new way checks the sftp response queue first for the response before polling/blocking on the channel. This gets rid of the potential infinite waiting bug.

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by Eshan Kelkar

Merge request reports

Loading
Loading