Skip to content

SCP/SFTP: avoid busy loop on receive #17533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

icing
Copy link
Contributor

@icing icing commented Jun 4, 2025

The libssh libraries do not reveal if they still have data buffered from the peer. Only when their buffers are read empty can curl be sure that it is safe to rely on socket polling.

This change adds detection of EAGAIN on receive in the transfer loop and allows SFTP/SCP transfers to avoid a busy loop in such a case (which should happen often when CPU exceeds network bandwidth).

The libssh libraries do not reveal if they still have data buffered
from the peer. Only when their buffers are read empty can curl be
sure that it is safe to rely on socket polling.

This change adds detection of EGAIN on receive in the transfer loop
and allows SFTP/SCP transfers to avoid a busy loop in such a case
(which should happen often when CPU exceeds network bandwidth).
@icing icing added the SCP/SFTP label Jun 4, 2025
@icing icing changed the title SCP/SFTP: avoid busy loop after EAGAIN SCP/SFTP: avoid busy loop on receive Jun 4, 2025
@icing icing requested a review from bagder June 4, 2025 14:01
@bagder bagder closed this in 34d694f Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants