浏览代码

Make NextRequestId property thread safe.

olegkap_cp 14 年之前
父节点
当前提交
7f0c5d2399
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Renci.SshClient/Renci.SshNet/Sftp/SftpSession.cs

+ 2 - 2
Renci.SshClient/Renci.SshNet/Sftp/SftpSession.cs

@@ -31,7 +31,7 @@ namespace Renci.SshNet.Sftp
         /// </summary>
         public int ProtocolVersion { get; private set; }
 
-        private uint _requestId;
+        private long _requestId;
         /// <summary>
         /// Gets the next request id for sftp session.
         /// </summary>
@@ -39,7 +39,7 @@ namespace Renci.SshNet.Sftp
         {
             get
             {
-                return this._requestId++;
+                return ((uint)Interlocked.Increment(ref this._requestId));
             }
         }