shikhar/sshj — Issue #44: sshj hangup while sending data through ChannelOutputStream
Author: bk1te
Created: 2011-12-01 13:31:00+00:00
State: open

Hello.
There are several issues while sending data through sshj data_channel:
1. When sshj connects to ssh server with small window size (smaller that maximum packet size)
and try to sent through data_channel data, more than this window accepts, sshj hangs
The possible explanation is sshj don`t send any CHANNEL_WINDOW_ADJUST message to server and lock.wait() don`t get interrupted.
2. When sshj connect to ssh server and local windows size (2MB) is greater than remote window size (1MB) while writing data to that channel server recieved sshPacket with size(32777) more than maxPacketSize allows (32768) and ssh server exits and sshj exits
The possible explanation to this, is that at the beggining of trans.write buffer.rpos() = 5 and buffer.wpos()=14 9 bytes that ruines sshPacket. I managed this issue by adding final int x = Math.min(len, win.getMaxPacketSize() - 9 - bufferLength). But i don`t think this is correct patch for this issue.

All tests could be done with dropbear ssh server where you could reproduce your problem
With OpenSSH everything works great