/// <summary> /// Process the next available messages in the message store and only returns once /// a message matching one of the ids in the filter array has arrived. /// </summary> /// <param name="observer"></param> /// <returns></returns> protected internal virtual SSHChannelMessage ProcessMessages(PacketObserver observer) { SSHChannelMessage msg; msg = (SSHChannelMessage)ms.NextMessage(observer); switch (msg.MessageID) { case SSH_MSG_WINDOW_ADJUST: { #if DEBUG LogMessage(msg); #endif remotewindow.adjust((int)msg.ReadUINT32()); break; } case SSH_MSG_CHANNEL_DATA: { byte[] data = msg.ReadBinaryString(); ProcessStandardData(data, 0, data.Length); break; } case SSH_MSG_CHANNEL_EXTENDED_DATA: { int type = (int)msg.ReadUINT32(); byte[] data = msg.ReadBinaryString(); ProcessExtendedData(type, data, 0, data.Length); break; } case SSH_MSG_CHANNEL_CLOSE: { remoteClosed = true; CheckCloseStatus(true); throw new System.IO.EndOfStreamException("The channel is closed"); } case SSH_MSG_CHANNEL_EOF: { try { stream.CloseInput(); } catch (System.IO.IOException) { } throw new System.IO.EndOfStreamException("The channel is EOF"); } default: break; } return(msg); }
internal void AdjustWindow(int increment) { try { SSHPacket packet = connection.GetPacket(); packet.WriteByte((System.Byte)SSH_MSG_WINDOW_ADJUST); packet.WriteUINT32(remoteid); packet.WriteUINT32(increment); localwindow.adjust(increment); #if DEBUG System.Diagnostics.Trace.WriteLine("Sending SSH_MSG_WINDOW_ADJUST"); System.Diagnostics.Trace.WriteLine("Channelid=" + ChannelID); #endif connection.SendMessage(packet); } catch (System.IO.IOException ex) { throw new SSHException(ex.Message, SSHException.INTERNAL_ERROR); } }