From bf5170a0080715963e3bc7464e3cbc3cd49f23ae Mon Sep 17 00:00:00 2001 From: Peter Hinz Date: Mon, 23 Sep 2019 10:28:36 +0200 Subject: [PATCH 1/5] Fixed bug in NATSBadSunscriptionException. - The passed error message was never forwarded to the NATSException container --- NATS.Client/Exceptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NATS.Client/Exceptions.cs b/NATS.Client/Exceptions.cs index 46bc995f4..cf0b542af 100644 --- a/NATS.Client/Exceptions.cs +++ b/NATS.Client/Exceptions.cs @@ -123,7 +123,7 @@ internal NATSMaxMessagesException() : base("Maximum number of messages have been public class NATSBadSubscriptionException : NATSException { internal NATSBadSubscriptionException() : base("Subscription is not valid.") { } - internal NATSBadSubscriptionException(string s) : base("s") { } + internal NATSBadSubscriptionException(string s) : base(s) { } } /// From 640d2c16699c72f149fd8fd139c3760156b22b5e Mon Sep 17 00:00:00 2001 From: Peter Hinz Date: Mon, 23 Sep 2019 10:29:31 +0200 Subject: [PATCH 2/5] Fixed the naming of a field. ArrivalSubscription had a type --- NATS.Client/Msg.cs | 6 +++--- NATSUnitTests/UnitTestBasic.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NATS.Client/Msg.cs b/NATS.Client/Msg.cs index f61593ff0..ef6ff5b73 100755 --- a/NATS.Client/Msg.cs +++ b/NATS.Client/Msg.cs @@ -162,7 +162,7 @@ public void AssignData(byte[] data) /// /// Gets the which received the message. /// - public ISubscription ArrivalSubcription + public ISubscription ArrivalSubscription { get { return sub; } } @@ -174,7 +174,7 @@ public ISubscription ArrivalSubcription /// /// is null or empty. /// -or- - /// is null. + /// is null. /// public void Respond(byte[] data) { @@ -183,7 +183,7 @@ public void Respond(byte[] data) throw new NATSException("No Reply subject"); } - Connection conn = ArrivalSubcription?.Connection; + Connection conn = ArrivalSubscription?.Connection; if (conn == null) { throw new NATSException("Message is not bound to a subscription"); diff --git a/NATSUnitTests/UnitTestBasic.cs b/NATSUnitTests/UnitTestBasic.cs index eacfa3412..385e20a99 100644 --- a/NATSUnitTests/UnitTestBasic.cs +++ b/NATSUnitTests/UnitTestBasic.cs @@ -247,7 +247,7 @@ public void TestAsyncSubscribe() private void CheckReceivedAndValidHandler(object sender, MsgHandlerEventArgs args) { Assert.True(compare(args.Message.Data, omsg), "Messages are not equal."); - Assert.Equal(asyncSub, args.Message.ArrivalSubcription); + Assert.Equal(asyncSub, args.Message.ArrivalSubscription); lock (mu) { From 8723f34e29ea93e014331ba8808752fd676fdada Mon Sep 17 00:00:00 2001 From: Peter Hinz Date: Mon, 23 Sep 2019 10:29:52 +0200 Subject: [PATCH 3/5] Fixed various typos --- NATS.Client/EncodedConn.cs | 12 ++++++------ NATS.Client/IConnection.cs | 4 ++-- NATS.Client/ISubscription.cs | 2 +- NATS.Client/NATS.cs | 2 +- NATS.Client/Options.cs | 10 +++++----- NATS.Client/ServerPool.cs | 6 +++--- NATS.Client/Statistics.cs | 2 +- NATSUnitTests/UnitTestConn.cs | 8 ++++---- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/NATS.Client/EncodedConn.cs b/NATS.Client/EncodedConn.cs index c843c4c97..7239e937a 100644 --- a/NATS.Client/EncodedConn.cs +++ b/NATS.Client/EncodedConn.cs @@ -114,7 +114,7 @@ internal EncodedConnection(Options opts) private IFormatter f = new BinaryFormatter(); // Note, the connection locks around this, so while we are using a - // byte array in the connection, we are still threadsafe. + // byte array in the connection, we are still thread safe. internal byte[] defaultSerializer(Object obj) { byte[] rv = null; @@ -143,7 +143,7 @@ internal byte[] defaultSerializer(Object obj) // it'd be nice to have a default serializer per subscription to avoid // the lock here, but this mirrors go. // - // TODO: Look at moving the default to the wrapper and keeping a derialization + // TODO: Look at moving the default to the wrapper and keeping a deserialization // stream there. internal object defaultDeserializer(byte[] data) { @@ -182,7 +182,7 @@ private void publishObject(string subject, string reply, object o) /// The to serialize and publish to the connected NATS server. /// is /// null or entirely whitespace. - /// The serialzed form of exceeds the maximum payload size + /// The serialized form of exceeds the maximum payload size /// supported by the NATS server. /// The is closed. /// is null. @@ -204,7 +204,7 @@ public void Publish(string subject, Object obj) /// The to serialize and publish to the connected NATS server. /// is null or /// entirely whitespace. - /// The serialzed form of exceeds the maximum payload size + /// The serialized form of exceeds the maximum payload size /// supported by the NATS server. /// The is closed. /// is null. @@ -359,7 +359,7 @@ private object requestObject(string subject, object obj, int timeout) /// (0). /// is null or /// entirely whitespace. - /// The serialzed form of exceeds the maximum payload size + /// The serialized form of exceeds the maximum payload size /// supported by the NATS server. /// The is closed. /// A timeout occurred while sending the request or receiving the @@ -387,7 +387,7 @@ public object Request(string subject, object obj, int timeout) /// A with the deserialized response from the NATS server. /// is null or /// entirely whitespace. - /// The serialzed form of exceeds the maximum payload size + /// The serialized form of exceeds the maximum payload size /// supported by the NATS server. /// The is closed. /// A timeout occurred while sending the request or receiving the diff --git a/NATS.Client/IConnection.cs b/NATS.Client/IConnection.cs index 5f4bfa3c9..bd79fd23b 100644 --- a/NATS.Client/IConnection.cs +++ b/NATS.Client/IConnection.cs @@ -71,8 +71,8 @@ public interface IConnection : IDisposable /// NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a /// one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening /// on that subject receives the message. Subscribers can register interest in wildcard subjects. - /// In the basic NATS platfrom, if a subscriber is not listening on the subject (no subject match), - /// or is not acive when the message is sent, the message is not recieved. NATS is a fire-and-forget + /// In the basic NATS platform, if a subscriber is not listening on the subject (no subject match), + /// or is not active when the message is sent, the message is not received. NATS is a fire-and-forget /// messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the /// additional reliability into your client(s) yourself. /// diff --git a/NATS.Client/ISubscription.cs b/NATS.Client/ISubscription.cs index c9c807dcc..c1fe1ec73 100644 --- a/NATS.Client/ISubscription.cs +++ b/NATS.Client/ISubscription.cs @@ -45,7 +45,7 @@ public interface ISubscription /// Wildcards must be separate tokens (foo.*.bar or foo.> are syntactically /// valid; foo*.bar, f*o.b*r and foo> are not). /// - /// For example, the wildcard subscrpitions foo.*.quux and foo.> both match + /// For example, the wildcard subscriptions foo.*.quux and foo.> both match /// foo.bar.quux, but only the latter matches foo.bar.baz. With the full wildcard, /// it is also possible to express interest in every subject that may exist in NATS (>). /// diff --git a/NATS.Client/NATS.cs b/NATS.Client/NATS.cs index dcf8c272c..6030e24c1 100644 --- a/NATS.Client/NATS.cs +++ b/NATS.Client/NATS.cs @@ -240,7 +240,7 @@ internal get { if (signedNonce == null) { - throw new NATSConnectionException("SignedNonce was not set by the UserSignature event hander."); + throw new NATSConnectionException("SignedNonce was not set by the UserSignature event handler."); } return signedNonce; } diff --git a/NATS.Client/Options.cs b/NATS.Client/Options.cs index 33a0c2005..305cb1629 100644 --- a/NATS.Client/Options.cs +++ b/NATS.Client/Options.cs @@ -151,7 +151,7 @@ public void SetNkey(string publicNkey, EventHandler user /// sign the server nonce. /// /// The User's public Nkey - /// A path to a file contianing the private Nkey. + /// A path to a file containing the private Nkey. public void SetNkey(string publicNkey, string privateKeyPath) { if (string.IsNullOrWhiteSpace(publicNkey)) throw new ArgumentException("Invalid publicNkey", nameof(publicNkey)); @@ -462,12 +462,12 @@ public string Token } /// - /// Adds an X.509 certifcate from a file for use with a secure connection. + /// Adds an X.509 certificate from a file for use with a secure connection. /// /// Path to the certificate file to add. /// is null. /// An error with the certificate - /// ocurred. For example: + /// occurred. For example: /// /// The certificate file does not exist. /// The certificate is invalid. @@ -481,12 +481,12 @@ public void AddCertificate(string fileName) } /// - /// Adds an X.509 certifcate for use with a secure connection. + /// Adds an X.509 certificate for use with a secure connection. /// /// An X.509 certificate represented as an object. /// is null. /// An error with the certificate - /// ocurred. For example: + /// occurred. For example: /// /// The certificate file does not exist. /// The certificate is invalid. diff --git a/NATS.Client/ServerPool.cs b/NATS.Client/ServerPool.cs index c092e9554..098af6333 100644 --- a/NATS.Client/ServerPool.cs +++ b/NATS.Client/ServerPool.cs @@ -66,7 +66,7 @@ public int GetHashCode(Srv obj) // Create the server pool using the options given. // We will place a Url option first, followed by any - // Server Options. We will randomize the server pool unlesss + // Server Options. We will randomize the server pool unless // the NoRandomize flag is set. internal void Setup(Options opts) { @@ -220,7 +220,7 @@ private bool add(Srv s) } } - // removes implict servers NOT found in the provided list. + // removes implicit servers NOT found in the provided list. internal void PruneOutdatedServers(string[] newUrls) { LinkedList ulist = new LinkedList(newUrls); @@ -235,7 +235,7 @@ internal void PruneOutdatedServers(string[] newUrls) foreach (Srv s in tmp) { // The server returns ":". We can't compare - // againts Uri.Authority becase that API may strip out + // against Uri.Authority because that API may strip out // ports. string hp = string.Format("{0}:{1}", s.url.Host, s.url.Port); if (s.isImplicit && !ulist.Contains(hp) && diff --git a/NATS.Client/Statistics.cs b/NATS.Client/Statistics.cs index a27f6f71a..ac80a60ba 100755 --- a/NATS.Client/Statistics.cs +++ b/NATS.Client/Statistics.cs @@ -70,7 +70,7 @@ public long Reconnects get { return reconnects; } } - // deep copy contructor + // deep copy constructor internal Statistics(Statistics obj) { this.inMsgs = obj.inMsgs; diff --git a/NATSUnitTests/UnitTestConn.cs b/NATSUnitTests/UnitTestConn.cs index 2615f5e0f..8dd2e2a90 100644 --- a/NATSUnitTests/UnitTestConn.cs +++ b/NATSUnitTests/UnitTestConn.cs @@ -823,7 +823,7 @@ public void TestDrain() c.Drain(); done.WaitOne(5000); - Assert.True(received == expected, string.Format("recieved {0} of {1}", received, expected)); + Assert.True(received == expected, string.Format("received {0} of {1}", received, expected)); } } @@ -863,7 +863,7 @@ public void TestDrainAsync() t.Wait(); done.WaitOne(5000); - Assert.True(received == expected, string.Format("recieved {0} of {1}", received, expected)); + Assert.True(received == expected, string.Format("received {0} of {1}", received, expected)); } } @@ -897,7 +897,7 @@ public void TestDrainSub() s.Drain(); done.WaitOne(5000); - Assert.True(received == expected, string.Format("recieved {0} of {1}", received, expected)); + Assert.True(received == expected, string.Format("received {0} of {1}", received, expected)); } } @@ -937,7 +937,7 @@ public void TestDrainSubAsync() t.Wait(); done.WaitOne(5000); - Assert.True(received == expected, string.Format("recieved {0} of {1}", received, expected)); + Assert.True(received == expected, string.Format("received {0} of {1}", received, expected)); } } From 695848d42a9673d756d35436b9126e0bfeb30fea Mon Sep 17 00:00:00 2001 From: Peter Hinz Date: Wed, 25 Sep 2019 06:50:58 +0200 Subject: [PATCH 4/5] Added the old ArrivalSubcription property back with an Obsolete indicator --- NATS.Client/Msg.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/NATS.Client/Msg.cs b/NATS.Client/Msg.cs index ef6ff5b73..c55247330 100755 --- a/NATS.Client/Msg.cs +++ b/NATS.Client/Msg.cs @@ -159,10 +159,19 @@ public void AssignData(byte[] data) this.data = data; } - /// - /// Gets the which received the message. - /// - public ISubscription ArrivalSubscription + /// + /// Gets the which received the message. + /// + [ObsoleteAttribute("This property will soon be deprecated. Use ArrivalSubscription instead.")] + public ISubscription ArrivalSubcription + { + get { return sub; } + } + + /// + /// Gets the which received the message. + /// + public ISubscription ArrivalSubscription { get { return sub; } } From dedb094d1255a1edfb915ea810a287b7cf7ed6be Mon Sep 17 00:00:00 2001 From: Peter Hinz Date: Wed, 25 Sep 2019 06:59:42 +0200 Subject: [PATCH 5/5] Formatting has changed to the project default --- NATS.Client/Msg.cs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/NATS.Client/Msg.cs b/NATS.Client/Msg.cs index c55247330..61ea0014b 100755 --- a/NATS.Client/Msg.cs +++ b/NATS.Client/Msg.cs @@ -159,19 +159,19 @@ public void AssignData(byte[] data) this.data = data; } - /// - /// Gets the which received the message. - /// - [ObsoleteAttribute("This property will soon be deprecated. Use ArrivalSubscription instead.")] - public ISubscription ArrivalSubcription - { - get { return sub; } - } - - /// - /// Gets the which received the message. - /// - public ISubscription ArrivalSubscription + /// + /// Gets the which received the message. + /// + [ObsoleteAttribute("This property will soon be deprecated. Use ArrivalSubscription instead.")] + public ISubscription ArrivalSubcription + { + get { return sub; } + } + + /// + /// Gets the which received the message. + /// + public ISubscription ArrivalSubscription { get { return sub; } }