}
public void channelLoop() throws SSHException
{
SSHChannel chann = null;
SSHMessage msg = transport.readMessage();
switch (msg.getID()) {
case ChannelSuccessMessage.ID:
ChannelSuccessMessage m5 = (ChannelSuccessMessage)msg;
chann = locals.get(m5.getChannelId());
synchronized (chann.LOCK) {
chann.lastReqSuccess = true;
chann.LOCK.notify();
}
break;
case ChannelFailureMessage.ID:
ChannelFailureMessage m6 = (ChannelFailureMessage)msg;
chann = locals.get(m6.getChannelId());
synchronized (chann.LOCK) {
chann.lastReqSuccess = false;
chann.LOCK.notify();
}
break;
case ChannelRequestMessage.ID:
ChannelRequestMessage m0 = (ChannelRequestMessage)msg;
chann = locals.get(m0.getChannelId());
chann.handleRequest(m0.getRequest(), m0.getWantReply());
break;
case ChannelWindowsAdjustMessage.ID:
ChannelWindowsAdjustMessage m7
= (ChannelWindowsAdjustMessage)msg;
chann = locals.get(m7.getChannelId());
chann.adjustRemoteWindow(m7.getBytesToAdd());
break;
case ChannelEOFMessage.ID:
ChannelEOFMessage m2 = (ChannelEOFMessage)msg;
chann = locals.get(m2.getChannelId());
chann.eof();
break;
case ChannelDataMessage.ID:
ChannelDataMessage m1 = (ChannelDataMessage)msg;
chann = locals.get(m1.getChannelId());
chann.pushData(m1.getData());
break;
case ChannelExtendedDataMessage.ID:
ChannelExtendedDataMessage m3 =
(ChannelExtendedDataMessage)msg;
chann = locals.get(m3.getChannelId());
chann.pushExtendedData(m3.getData(), m3.getDataType());
break;
case ChannelOpenConfirmationMessage.ID:
try {
queue.put(msg);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
break;
case ChannelCloseMessage.ID:
ChannelCloseMessage m4 = (ChannelCloseMessage)msg;
chann = locals.get(m4.getChannelId());
chann.peerClose();
break;
default:
GlieseLogger.LOGGER.error(String.format(
"Unexpected message type: %d", msg.getID()));
}
}