diff --git a/src/NATS.Client/EncodedConn.cs b/src/NATS.Client/EncodedConn.cs index c1420ec04..f3a663145 100644 --- a/src/NATS.Client/EncodedConn.cs +++ b/src/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/src/NATS.Client/Exceptions.cs b/src/NATS.Client/Exceptions.cs index c7bda27b0..e90fca170 100644 --- a/src/NATS.Client/Exceptions.cs +++ b/src/NATS.Client/Exceptions.cs @@ -141,7 +141,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) { } } /// diff --git a/src/NATS.Client/IConnection.cs b/src/NATS.Client/IConnection.cs index ec98edde4..22ef52da1 100644 --- a/src/NATS.Client/IConnection.cs +++ b/src/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/src/NATS.Client/ISubscription.cs b/src/NATS.Client/ISubscription.cs index 5d5174752..c0b5e938c 100644 --- a/src/NATS.Client/ISubscription.cs +++ b/src/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/src/NATS.Client/Msg.cs b/src/NATS.Client/Msg.cs index 041da1920..e7d4c561d 100644 --- a/src/NATS.Client/Msg.cs +++ b/src/NATS.Client/Msg.cs @@ -162,11 +162,20 @@ public void AssignData(byte[] 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 + { + get { return sub; } + } + /// /// Send a response to the message on the arrival subscription. /// @@ -174,7 +183,7 @@ public ISubscription ArrivalSubcription /// /// is null or empty. /// -or- - /// is null. + /// is null. /// public void Respond(byte[] data) { @@ -183,7 +192,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/src/NATS.Client/NATS.cs b/src/NATS.Client/NATS.cs index 0f8469250..e252775d5 100644 --- a/src/NATS.Client/NATS.cs +++ b/src/NATS.Client/NATS.cs @@ -247,7 +247,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/src/NATS.Client/Options.cs b/src/NATS.Client/Options.cs index 7536afaf1..eb0559987 100644 --- a/src/NATS.Client/Options.cs +++ b/src/NATS.Client/Options.cs @@ -152,7 +152,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)); @@ -509,12 +509,12 @@ public string CustomInboxPrefix } /// - /// 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. @@ -528,12 +528,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/src/NATS.Client/ServerPool.cs b/src/NATS.Client/ServerPool.cs index 2a89ac4c1..25a2016cc 100644 --- a/src/NATS.Client/ServerPool.cs +++ b/src/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/src/NATS.Client/Statistics.cs b/src/NATS.Client/Statistics.cs index 9ee2350cd..b25b34e83 100644 --- a/src/NATS.Client/Statistics.cs +++ b/src/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/src/Tests/IntegrationTests/TestBasic.cs b/src/Tests/IntegrationTests/TestBasic.cs index 8948aad35..3ee132a24 100644 --- a/src/Tests/IntegrationTests/TestBasic.cs +++ b/src/Tests/IntegrationTests/TestBasic.cs @@ -230,7 +230,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) { diff --git a/src/Tests/IntegrationTests/TestConnection.cs b/src/Tests/IntegrationTests/TestConnection.cs index ab52d8c25..87b8a8b85 100644 --- a/src/Tests/IntegrationTests/TestConnection.cs +++ b/src/Tests/IntegrationTests/TestConnection.cs @@ -18,8 +18,8 @@ using Xunit; using System.Diagnostics; using System.Threading.Tasks; -using System.Timers; - +using System.Timers; + namespace IntegrationTests { public class TestConnection : TestSuite @@ -793,7 +793,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)); } } @@ -833,7 +833,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)); } } @@ -867,7 +867,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)); } } @@ -907,7 +907,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)); } } @@ -1034,7 +1034,7 @@ public async Task TestDrainStateBehavior() var opts = Context.GetTestOptionsWithDefaultTimeout(Context.Server1.Port); opts.ClosedEventHandler = (obj, args) => { - closed.Set(); + closed.Set(); }; var c = Context.ConnectionFactory.CreateConnection(opts); var s = c.SubscribeAsync("foo", (obj, args) => @@ -1067,35 +1067,35 @@ public async Task TestDrainStateBehavior() } [Fact] - public void TestFlushBuffer() - { - IConnection c = null; - AutoResetEvent disconnected = new AutoResetEvent(false); - AutoResetEvent closed = new AutoResetEvent(false); - + public void TestFlushBuffer() + { + IConnection c = null; + AutoResetEvent disconnected = new AutoResetEvent(false); + AutoResetEvent closed = new AutoResetEvent(false); + using (NATSServer.CreateFastAndVerify(Context.Server1.Port)) - { + { var opts = Context.GetTestOptionsWithDefaultTimeout(Context.Server1.Port); opts.ClosedEventHandler = (obj, args) => { - closed.Set(); + closed.Set(); }; opts.DisconnectedEventHandler = (obj, args) => { - disconnected.Set(); + disconnected.Set(); }; - c = Context.ConnectionFactory.CreateConnection(opts); - - // test empty buffer - c.FlushBuffer(); - // test multiple calls - c.FlushBuffer(); - - c.Publish("foo", new byte[10240]); - c.FlushBuffer(); + c = Context.ConnectionFactory.CreateConnection(opts); + + // test empty buffer + c.FlushBuffer(); + // test multiple calls + c.FlushBuffer(); + + c.Publish("foo", new byte[10240]); + c.FlushBuffer(); } // wait until we're disconnected @@ -1108,12 +1108,12 @@ public void TestFlushBuffer() c.FlushBuffer(); // close and then check the closed connection. - c.Close(); - Assert.True(closed.WaitOne(10000)); - Assert.Throws(() => c.FlushBuffer()); - - c.Dispose(); - } + c.Close(); + Assert.True(closed.WaitOne(10000)); + Assert.Throws(() => c.FlushBuffer()); + + c.Dispose(); + } } public class TestConnectionMemoryLeaks : TestSuite