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

Immediately open and then close a client handle - why? #55

Open
m-kostrzewa opened this issue Jul 4, 2017 · 2 comments
Open

Immediately open and then close a client handle - why? #55

m-kostrzewa opened this issue Jul 4, 2017 · 2 comments

Comments

@m-kostrzewa
Copy link

m-kostrzewa commented Jul 4, 2017

Hi,

could someone explain why this is there?

https://github.com/Microsoft/go-winio/blob/master/pipe.go#L337-L339

	// Immediately open and then close a client handle so that the named pipe is
	// created but not currently accepting connections.
	h2, err := createFile(path, 0, 0, nil, syscall.OPEN_EXISTING, cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0)
@gdamore
Copy link
Contributor

gdamore commented Jun 24, 2018

I think this code was intended to ensure that an instance of the pipe exists, so that you won't see ERROR_FILE_NOT_FOUND. But I think its probably misguided, and that a better approach would be to actually have the listener keep a named pipe instance in standby. I'll be working on code to do just that shortly.

@gdamore
Copy link
Contributor

gdamore commented Jun 24, 2018

Have a look at PR #80 -- closing that handle turned out to be mistaken, IMO, and is probably ultimately a part of the root cause for #67

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

2 participants