Skip to content

Make ChannelInputStream respect connection timeout#1034

Open
jpstotz wants to merge 4 commits intohierynomus:masterfrom
jpstotz:ChannelInputStreamTimeout
Open

Make ChannelInputStream respect connection timeout#1034
jpstotz wants to merge 4 commits intohierynomus:masterfrom
jpstotz:ChannelInputStreamTimeout

Conversation

@jpstotz
Copy link
Copy Markdown
Contributor

@jpstotz jpstotz commented Mar 26, 2026

If the ChannelInputStream does not get new data it waits without timeout.

This patch makes ChannelInputStream respect the timeout configured in the Connection.

fixes #731

@jpstotz jpstotz requested a review from hierynomus as a code owner March 26, 2026 13:19
@jpstotz
Copy link
Copy Markdown
Contributor Author

jpstotz commented Mar 26, 2026

In my first version I used Object.wait(long) but this method has the drawback that you can not identify if it returns because of a notifyAll() call or if a timeout occurred.

Therefore I changed the implementation from synchronized(buf) {..} blocks and Object.wait(..) Object.notifyAll() calls to ReentrantLock and Condition as the latter allows us to detect if there was a timeout or not when using
Condition.await​(long time, TimeUnit unit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCP File uploads stuck if the remote didn't send status code

1 participant