Skip to content

Poll the channel in ssh_channel_poll() when the buffer isn't empty

James Wrigley requested to merge JamesWrigley/libssh-mirror:channel-poll into master

This is a somewhat speculative attempt to fix an issue I found where ssh_channel_poll() wouldn't execute the callbacks set on a channel if the buffer it was passed already had some data. That was quite confusing because AFAICT there's no other way in the public API to poll a channel except by creating a poll context like ssh_handle_packets() does (I ended up polling both stdout and stderr in the hope that at least one them would be empty). I'm not even sure if it's expected that the channel could get into this state in non-blocking mode? If this is doing the right thing I can try to write some tests for it.

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

Merge request reports

Loading