Procházet zdrojové kódy

Added comments to clarify code.

Added comments to clarify code.
drieseng před 9 roky
rodič
revize
a69a6d6486

+ 6 - 2
src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalInfo.cs

@@ -137,6 +137,9 @@ namespace Renci.SshNet.Messages.Connection
 
             if (TerminalModeValues != null)
             {
+                // write total length of encoded terminal modes, which is 1 bytes for the opcode / terminal mode
+                // and 4 bytes for the uint argument for each entry; the encoded terminal modes are terminated by
+                // opcode TTY_OP_END (which is 1 byte)
                 Write((uint) TerminalModeValues.Count*(1 + 4) + 1);
 
                 foreach (var item in TerminalModeValues)
@@ -144,11 +147,12 @@ namespace Renci.SshNet.Messages.Connection
                     Write((byte) item.Key);
                     Write(item.Value);
                 }
-                Write((byte)0);
+
+                Write((byte) TerminalModes.TTY_OP_END);
             }
             else
             {
-                Write((uint)0);
+                Write((uint) 0);
             }
         }
     }