pkg / sftp

SFTP support for the go.crypto/ssh package
BSD 2-Clause "Simplified" License
1.49k stars 379 forks source link

Cancelable ReadDirContext #565

Closed ungerik closed 8 months ago

ungerik commented 8 months ago

Added method Client.ReadDirContext to be able to cancel long-running dir listings.

The passed context can cancel the operation returning all entries listed up to the cancellation.

puellanivis commented 8 months ago

Hm… probably not the change I would have made… but probably a change for the better… 🤔

P.S.: That is to say, I would have limited the scope of the change rather than plumb a context everywhere. But then, the context should probably be there anyways, so. 🤷‍♀️

ungerik commented 8 months ago

It has become a reflex to add ctx everywhere. So far it never turned out that there were too many ctx in any code base, if there were problems then because of not enough ctx ;-)

ungerik commented 8 months ago

But I can rewrite the PR if you want...

puellanivis commented 8 months ago

No, there is no need to rewrite, I don’t think the plumbed context will cause any performance issues.