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

Move the TimeoutConn a separate /pkg dir #10965

Closed
crosbymichael opened this issue Feb 23, 2015 · 1 comment
Closed

Move the TimeoutConn a separate /pkg dir #10965

crosbymichael opened this issue Feb 23, 2015 · 1 comment
Labels
kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@crosbymichael
Copy link
Contributor

Summary:

Currently there is code in /utils/timeoutcon.go and /utils/timeoutconn_test.go to handle timeouts of network connections. This package is too big and it would help to move this type and it's tests to a new package.

Proposed solution:

Move the type and tests into a new package inside the /pkg directory called timeout and refactor the API. A proposed change for the function could look like:

import "github.com/docker/docker/pkg/timeout"

tc := timeout.New(conn, 1*time.Second)

Being inside a separate package this type does not need to be exported. You can do this by changing the case from TimeoutConn to timeoutConn. Also because moving this into a separate package already namespaces the types, it would be redundent to keep the word timeout or conn in the type and constructor names. It's much simpler to have just conn and New as the responsibility is clear based on the package that they are in.

@crosbymichael crosbymichael added white-belt kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Feb 23, 2015
@gewoonrik
Copy link
Contributor

I'd love to give this a try.

richardcrichardc pushed a commit to richardcrichardc/docker that referenced this issue Mar 2, 2015
Fixes moby#10965
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

2 participants