Skip to content

dial context shall be dial timeout context in connector.go #1034

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

Closed
zjj opened this issue Nov 20, 2019 · 0 comments
Closed

dial context shall be dial timeout context in connector.go #1034

zjj opened this issue Nov 20, 2019 · 0 comments

Comments

@zjj
Copy link
Contributor

zjj commented Nov 20, 2019

Issue description

the ctx for dial or DialContext shall some context that from cfg.Timeout // Dial timeout,
but not the context from open.

Example code

connector.go

/ Connect implements driver.Connector interface.
// Connect returns a connection to the database.
func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {
	...
	if ok {
		mc.netConn, err = dial(ctx, mc.cfg.Addr)
	} else {
		nd := net.Dialer{Timeout: mc.cfg.Timeout}
		mc.netConn, err = nd.DialContext(ctx, mc.cfg.Net, mc.cfg.Addr)
	}

	...

Error log

n/a

Configuration

current master b4242ba

tz70s pushed a commit to tz70s/mysql that referenced this issue Sep 5, 2020
tz70s pushed a commit to tz70s/mysql that referenced this issue Sep 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

No branches or pull requests

1 participant