diff --git a/NaiveSocksCliShared/BuildInfo.cs b/NaiveSocksCliShared/BuildInfo.cs index 9e15b34..fd35ead 100644 --- a/NaiveSocksCliShared/BuildInfo.cs +++ b/NaiveSocksCliShared/BuildInfo.cs @@ -13,7 +13,7 @@ static BuildInfo() } } - public const string Version = "0.3.12.0"; + public const string Version = "0.3.12.1"; public const bool Debug = #if DEBUG diff --git a/NaiveSvrLib/NaiveSvrShared/HttpSvr/HttpConnection.cs b/NaiveSvrLib/NaiveSvrShared/HttpSvr/HttpConnection.cs index 4cc8061..001689a 100644 --- a/NaiveSvrLib/NaiveSvrShared/HttpSvr/HttpConnection.cs +++ b/NaiveSvrLib/NaiveSvrShared/HttpSvr/HttpConnection.cs @@ -201,7 +201,7 @@ private async Task _requestingLoop() } catch (Exception e) { if (disconnecting || myStream.State.IsClosed) break; - server.logException(e, Logging.Level.Warning, $"[{server.mark}#{id}({requestCount}) {remoteEP}] handling"); + server.logException(e, Logging.Level.Warning, $"[{server.mark}#{Id}({requestCount}) {remoteEP}] handling"); if (ConnectionState == States.SwitchedProtocol) break; if (ConnectionState == States.Processing & outputStream.Position == 0) { @@ -512,15 +512,15 @@ internal void writeResponseTo(TextWriter writer) writer.Write("\r\n"); } - public int Id => id; - private int id = id_counter++; - private static int id_counter = 0; + public int Id { get; } = idGen.Get(); + + private static IncrNumberGenerator idGen = new IncrNumberGenerator(); public void info(string text) => log(text, Logging.Level.Info); public virtual void log(string text, Logging.Level level) { - server.log($"(#{id}|{remoteEP}({RequestCount})) {text}", level); + server.log($"(#{Id}|{remoteEP}({RequestCount})) {text}", level); } public Stream SwitchProtocol() @@ -538,9 +538,9 @@ public override string ToString() public virtual string ToString(bool verbose) { if (verbose) - return $"{{HttpConn #{id}|{remoteEP}({RequestCount})}}"; + return $"{{HttpConn #{Id}|{remoteEP}({RequestCount})}}"; else - return $"{{HttpConn #{id}({RequestCount})}}"; + return $"{{HttpConn #{Id}({RequestCount})}}"; } #region IDisposable Support