Skip to content
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

NoEcho Option Support #375

Merged
merged 4 commits into from Jul 25, 2018
Merged

NoEcho Option Support #375

merged 4 commits into from Jul 25, 2018

Conversation

derekcollison
Copy link
Member

Added support to pass in a NoEcho option. Old servers that do not support will error.

Signed-off-by: Derek Collison <derek@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like some feedback on my comments, but otherwise, I think this would work as-is.

b, err := json.Marshal(cinfo)
if err != nil {
return _EMPTY_, ErrJsonParse
}

// Check if NoEcho is set and we have a server that supports it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do this test in processExpectedInfo() instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could if you think that is a better place. When forming the connectProto we know we have received the server info and are processing the options to some degree, hence why I stuck it there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine I guess, although you could do this check at top of function, since there is no point in marshalling etc.. if we are going to return an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted a marshal error to take precedence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

t.Fatalf("Error on publish: %v", err)
}
nc.Flush()
nc.Flush()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional to have 2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, especially in Travis, this is not enough to guarantee that there is no bug and message is not going to be incorrectly delivered. Maybe you would need 1 flush, but using a different connection, publish an other message, that message should be received, but not the first one.

All that being said, I do believe that the feature is tested in the server. We should focus here in testing APIs related features, which is make sure that the "echo" field is set as expected in the INFO, etc...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the two was intentional instead of having to do a sleep or gosched() call since first may have the scheduler unblock the flush call before firing the async callback. I could make it sync maybe.. Or just comment as to why there are two.

@kozlovic
Copy link
Member

LGTM

Signed-off-by: Derek Collison <derek@nats.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants