浏览代码

Apply 14339 patch

olegkap_cp 12 年之前
父节点
当前提交
3af40a0f83

+ 2 - 0
Renci.SshClient/Renci.SshNet/ForwardedPortLocal.NET.cs

@@ -26,6 +26,8 @@ namespace Renci.SshNet
 
             this._listener = new TcpListener(ep);
             this._listener.Start();
+            //  Update bound port if original was passed as zero
+			this.BoundPort = (uint) ((IPEndPoint) _listener.LocalEndpoint).Port;
 
             this.Session.ErrorOccured += Session_ErrorOccured;
             this.Session.Disconnected += Session_Disconnected;

+ 13 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortLocal.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Threading;
+using System.Net;
 
 namespace Renci.SshNet
 {
@@ -9,12 +10,12 @@ namespace Renci.SshNet
     public partial class ForwardedPortLocal : ForwardedPort, IDisposable
     {
         private EventWaitHandle _listenerTaskCompleted;
-
+		
         /// <summary>
         /// Gets the bound host.
         /// </summary>
         public string BoundHost { get; protected set; }
-
+		
         /// <summary>
         /// Gets the bound port.
         /// </summary>
@@ -44,6 +45,16 @@ namespace Renci.SshNet
         {
         }
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
+        /// </summary>
+        /// <param name="host">The host.</param>
+        /// <param name="port">The port.</param>
+		public ForwardedPortLocal(string boundHost, string host, uint port)
+			: this(boundHost, 0, host, port) 
+		{
+		}
+
         /// <summary>
         /// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
         /// </summary>