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

Agent connection pool cleanup #7966

Merged
merged 3 commits into from
Jun 4, 2020
Merged

Agent connection pool cleanup #7966

merged 3 commits into from
Jun 4, 2020

Conversation

hanshasselberg
Copy link
Member

@hanshasselberg hanshasselberg commented May 28, 2020

Removes some of the cruft from agent connection pool. Best viewed by commit.

The version field has been used to decide which multiplexing to use. It
was introduced in 2457293. But this is
6y ago and there is no need for this differentiation anymore.
In the past TLS usage was enforced with these variables, but these days
this decision is made by TLSConfigurator and there is no reason to keep
using the variables.
Timeout was never used in a meaningful way by callers, which is why it
is now entirely internal to the pool.
var codec rpc.ClientCodec
conn, _, err := p.DialTimeoutInsecure(dc, nodeName, addr, 1*time.Second, p.TLSConfigurator.OutgoingRPCWrapper())
conn, _, err := p.dial(dc, nodeName, addr, 1*time.Second, 0, RPCTLSInsecure)
Copy link
Member

Choose a reason for hiding this comment

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

The second to last arg is zero because it doesn't matter what the value is, right? In the prior invocation RPCTLSInsecure was passed for both values (and the second-to-last value was still similarly ignored).

Copy link
Member Author

@hanshasselberg hanshasselberg Jun 3, 2020

Choose a reason for hiding this comment

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

Yes! dial ignores the second to last value if it is in RPCTLSInsecure mode:

consul/agent/pool/pool.go

Lines 371 to 376 in 1fbc1d4

if tlsRPCType != RPCTLSInsecure {
if _, err := conn.Write([]byte{byte(actualRPCType)}); err != nil {
conn.Close()
return nil, nil, err
}
}

Copy link
Member

@rboyer rboyer left a comment

Choose a reason for hiding this comment

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

LGTM

@hanshasselberg hanshasselberg merged commit 0f34333 into master Jun 4, 2020
@hanshasselberg hanshasselberg deleted the pool_improvements branch June 4, 2020 06:56
hashicorp-ci pushed a commit that referenced this pull request Jun 5, 2020
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.

2 participants