Misc. cleanup

Signed-off-by: John Starks <jostarks@microsoft.com>
This commit is contained in:
John Starks
2016-01-31 14:18:04 -08:00
parent 3aa597fc55
commit fe517a5118
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ type ioOperation struct {
} }
func initIo() { func initIo() {
h, err := createIoCompletionPort(syscall.InvalidHandle, syscall.Handle(0), 0, 0xffffffff) h, err := createIoCompletionPort(syscall.InvalidHandle, 0, 0, 0xffffffff)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@@ -92,7 +92,7 @@ func (f *win32File) closeHandle() {
cancelIoEx(f.handle, nil) cancelIoEx(f.handle, nil)
f.wg.Wait() f.wg.Wait()
// at this point, no new IO can start // at this point, no new IO can start
syscall.CloseHandle(f.handle) syscall.Close(f.handle)
f.handle = 0 f.handle = 0
} }
} }
+8 -8
View File
@@ -113,7 +113,7 @@ func DialPipe(path string, timeout *time.Duration) (net.Conn, error) {
} }
p, err := makeWin32Pipe(h, path) p, err := makeWin32Pipe(h, path)
if err != nil { if err != nil {
syscall.CloseHandle(h) syscall.Close(h)
return nil, err return nil, err
} }
return p, nil return p, nil
@@ -142,7 +142,7 @@ func makeServerPipeHandle(path, securityDescriptor string, first bool) (syscall.
if securityDescriptor != "" { if securityDescriptor != "" {
err := convertStringSecurityDescriptorToSecurityDescriptor(securityDescriptor, 1, &sd, nil) err := convertStringSecurityDescriptorToSecurityDescriptor(securityDescriptor, 1, &sd, nil)
if err != nil { if err != nil {
return syscall.Handle(0), err return 0, err
} }
} }
var sa syscall.SecurityAttributes var sa syscall.SecurityAttributes
@@ -153,7 +153,7 @@ func makeServerPipeHandle(path, securityDescriptor string, first bool) (syscall.
localFree(sd) localFree(sd)
} }
if err != nil { if err != nil {
return syscall.Handle(0), &os.PathError{"open", path, err} return 0, &os.PathError{"open", path, err}
} }
return h, nil return h, nil
} }
@@ -165,7 +165,7 @@ func (l *win32PipeListener) makeServerPipe() (*win32Pipe, error) {
} }
p, err := makeWin32Pipe(h, l.path) p, err := makeWin32Pipe(h, l.path)
if err != nil { if err != nil {
syscall.CloseHandle(h) syscall.Close(h)
return nil, err return nil, err
} }
return p, nil return p, nil
@@ -205,8 +205,8 @@ func (l *win32PipeListener) listenerRoutine() {
responseCh <- acceptResponse{p, err} responseCh <- acceptResponse{p, err}
} }
} }
syscall.CloseHandle(l.firstHandle) syscall.Close(l.firstHandle)
l.firstHandle = syscall.Handle(0) l.firstHandle = 0
// Notify Close() and Accept() callers that the handle has been closed. // Notify Close() and Accept() callers that the handle has been closed.
close(l.doneCh) close(l.doneCh)
} }
@@ -220,10 +220,10 @@ func ListenPipe(path, securityDescriptor string) (net.Listener, error) {
// created but not currently accepting connections. // created but not currently accepting connections.
h2, err := createFile(path, 0, 0, nil, syscall.OPEN_EXISTING, cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0) h2, err := createFile(path, 0, 0, nil, syscall.OPEN_EXISTING, cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0)
if err != nil { if err != nil {
syscall.CloseHandle(h) syscall.Close(h)
return nil, err return nil, err
} }
syscall.CloseHandle(h2) syscall.Close(h2)
l := &win32PipeListener{ l := &win32PipeListener{
firstHandle: h, firstHandle: h,
path: path, path: path,