Support Windows Named Pipe REDUX#1654
Conversation
fa736cd to
498c6e2
Compare
|
I have NO IDEA if this works. Theoretically you should just be able to pass |
|
/cc @aluzzardi @mavenugo |
|
This is totally broken, actually. please stand by. |
498c6e2 to
f9eaa76
Compare
|
This should work now, PTAL. |
Current coverage is 55.98% (diff: 25.00%)@@ master #1654 diff @@
==========================================
Files 89 89
Lines 14598 14494 -104
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 8139 8114 -25
+ Misses 5372 5297 -75
+ Partials 1087 1083 -4
|
xnet/net_windows.go
Outdated
| // we need to use named pipes `npipe` as the control api instead. | ||
| // so, here, we just use a hack. if the protocol is says unix but we're on | ||
| // windows, just use a named pipe anyway. problem changed. | ||
| if proto == "unix" { |
There was a problem hiding this comment.
Personally I don't think this hack belongs here.
Just make this a ListenLocal function that isn't passed a protocol. The windows version should use winio.ListenPipe and the unix version should use Listen("unix", addr).
For now the manager can special-case "unix" as needing a call to ListenLocal, but I think we should immediately refactor the manager to remove the ProtoAddr map so the hack isn't necessary.
There was a problem hiding this comment.
I agree that this should be done, but then it leads itself right into unrolling that loop and doing a big refactor of the listening code, which is a headache all of its own. I'd say anything more than a straight API substitution is out of scope.
There was a problem hiding this comment.
I think that loop could be easily unrolled - right now most of the content is unix specific anyway and the tcp side is pretty straightforward:
if _, ok := config.ProtoListener["unix"]; !ok {
l, err := xnet.ListenLocal(config.ProtoAddr["unix"])
...
// No need for proto == "unix"
if unwrappedErr == syscall.EADDRINUSE {
}
...
}
if _, ok := config.ProtoListener["tcp"]; !ok {
// Note no need to use xnet here
... := net.Listen("tcp", config.ProtoAddr["unix"])
// No need for weird if proto == "tcp"
tcpAddr = l.Addr().String()
}Thoughts?
I think that loop can be just unrolled to two if and we don't have to mess with proto == [tcp|unix] in the loop, just add the statements
There was a problem hiding this comment.
To @dperny's point - I don't know if that should be done in a separate PR to keep the scope of this one simple.
1aa0a20 to
2120b77
Compare
|
This is the docker/docker change. |
| return nil, errors.Wrap(err, "failed to create socket directory") | ||
| // don't create a socket directory if we're on windows. we used named pipe | ||
| if runtime.GOOS != "windows" { | ||
| err := os.MkdirAll(filepath.Dir(config.ProtoAddr["unix"]), 0700) |
There was a problem hiding this comment.
Do we need MkdirAll for npipes?
There was a problem hiding this comment.
oohhhhh that's not good. that's wrong. that should be GOOS == "windows"
There was a problem hiding this comment.
no it definitely is supposed to be GOOS != "windows". if the OS is not windows we create a directory. we don't need to make a directory for windows named pipes; they exist in their own, like, space.
6d5dce7 to
2a31308
Compare
|
Not a fan of What if we had a manager.listenLocal() function defined in |
|
We also have a dialer function, which is called from |
2a31308 to
8b2bc1d
Compare
|
i have no idea what i broke. |
|
The integration tests have been acting up recently. It's probably not your fault. |
Adds support for windows named pipes by adding an xnet package containing functions for opening platform-agnostic local sockets Signed-off-by: Drew Erny <drew.erny@docker.com>
8b2bc1d to
a1c8923
Compare
|
@aaronlehmann @aluzzardi updated, PTAL |
|
LGTM |
|
Merging this to make way for additional changes. |
Integrate xnet package into the modern code
xnet package was authored by Chanwit Kaewkasi chanwit@gmail.com. Integration is largely also based his work PR #941. This is a separate commit because a rebase was prohibitively difficult
I can break this into two different commits, one with him as author, if he approves, so he gets git credit for his added code. I did this locally but then reverted it because of potential legal issues (and I didn't want to put words in his mouth).
Signed-off-by: Drew Erny drew.erny@docker.com