-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove client side check against server info max_payload when publishing #781
Conversation
@@ -99,7 +99,7 @@ internal enum ClientProtcolVersion | |||
// encoded conn rather than using this class as | |||
// a base class. This can happen anytime as we are using | |||
// interfaces. | |||
public class Connection : IConnection, IDisposable | |||
public class Connection : IConnection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I was in here, IConnection is already IDisposable
// Proactively reject payloads over the threshold set by server. | ||
if (count > info.MaxPayload) | ||
throw new NATSMaxPayloadException(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the change. info
is Server info. Simply don't check it.
@@ -2680,8 +2676,6 @@ internal void PublishImpl(string subject, string reply, MsgHeader inHeaders, byt | |||
/// to the connected NATS server.</param> | |||
/// <exception cref="NATSBadSubscriptionException"><paramref name="subject"/> is | |||
/// <c>null</c> or entirely whitespace.</exception> | |||
/// <exception cref="NATSMaxPayloadException"><paramref name="data"/> exceeds the maximum payload size | |||
/// supported by the NATS server.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed api doc since this exception is not thrown anymore. There are 34 total of this exact change.
} | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that happens is the connection gets closed. There probably is an error message sent from the server, but the connection is already closed so it never bubbles up. Not sure if this is great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A different issue, but I'm wondering there is a way to pull the remaining data from the 1/2 closed TCP socket. Doubtful, but it'd be interesting to look into for error conditions like this.
|
||
using (NATSServer.CreateJetStreamFast()) | ||
{ | ||
Assert.Throws<NATSJetStreamException>(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synchronous publishes get an exception.
} | ||
} | ||
Assert.True(receivedDisconnect); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asynchronous publishes do not an exception, but the connection is closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
No description provided.