Exemple #1
0
        private bool BlockForMessage()
        {
            SSHPacket packet = reader.NextMessage();

#if DEBUG
            System.Diagnostics.Trace.WriteLine("Received message id " + packet.MessageID);
#endif

            if (IsChannelMessage(packet.MessageID))
            {
                packet = new SSHChannelMessage(packet);
            }


            // Determine the destination channel (if any)
            SSHAbstractChannel destination = null;
            if (packet is SSHChannelMessage)
            {
                destination = channels[((SSHChannelMessage)packet).ChannelID];
            }

            // Call the destination so that they may process the message
            bool processed = destination == null
                                ? ProcessGlobalMessage(packet)
                                : destination.ProcessChannelMessage((SSHChannelMessage)packet);

            // If the previous call did not process the message then add to the
            // destinations message store
            if (!processed)
            {
                SSHPacketStore ms = destination == null? global : destination.MessageStore;
//#if DEBUG
//						System.Diagnostics.Trace.WriteLine("Adding message " + packet.MessageID + " to store " + ms.ToString() );
//#endif

                ms.AddMessage(packet);
            }


            return(!processed);
        }
Exemple #2
0
 /// <summary>
 /// Process a channel message.
 /// </summary>
 /// <param name="m"></param>
 /// <returns></returns>
 protected internal abstract bool ProcessChannelMessage(SSHChannelMessage m);