Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-9796: Fix
SftpSession.write()
for concurrency
Fixes: #9796 Issue link: #9796 The `org.apache.sshd.sftp.client.impl.SftpOutputStreamAsync` is shared object for the `DefaultSftpClient` and it cannot be used concurrently. The guarded `send()` operation in the `ConcurrentSftpClient` is not enough since `DefaultSftpClient.write()` is called directly from the `SftpOutputStreamAsync.internalFlush()`. And this in the end is called from the `SftpSession.write()` * Fix `DefaultSftpSessionFactory.ConcurrentSftpClient` to override the `write()` method instead. Guard it with a `Lock` and call `sftpMessage.waitUntilSent();` to ensure that no concurrent access to the underlying `SftpOutputStreamAsync`. **Auto-cherry-pick to `6.4.x` & `6.3.x`**
- Loading branch information