1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #33310 from darrenstahlmsft/RevendorGowinio

Revendor go-winio to v0.4.1
This commit is contained in:
Vincent Demeester 2017-05-22 10:31:57 -07:00 committed by GitHub
commit 65f360fc41
3 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# the following lines are in sorted order, FYI # the following lines are in sorted order, FYI
github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62 github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
github.com/Microsoft/hcsshim v0.5.17 github.com/Microsoft/hcsshim v0.5.17
github.com/Microsoft/go-winio v0.4.0 github.com/Microsoft/go-winio v0.4.1
github.com/Sirupsen/logrus v0.11.0 github.com/Sirupsen/logrus v0.11.0
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a

View file

@ -124,7 +124,8 @@ func (f *win32File) Close() error {
return nil return nil
} }
// prepareIo prepares for a new IO operation // prepareIo prepares for a new IO operation.
// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning.
func (f *win32File) prepareIo() (*ioOperation, error) { func (f *win32File) prepareIo() (*ioOperation, error) {
f.wg.Add(1) f.wg.Add(1)
if f.closing { if f.closing {
@ -155,7 +156,6 @@ func ioCompletionProcessor(h syscall.Handle) {
// the operation has actually completed. // the operation has actually completed.
func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) {
if err != syscall.ERROR_IO_PENDING { if err != syscall.ERROR_IO_PENDING {
f.wg.Done()
return int(bytes), err return int(bytes), err
} }
@ -192,7 +192,6 @@ func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, er
// code to ioCompletionProcessor, c must remain alive // code to ioCompletionProcessor, c must remain alive
// until the channel read is complete. // until the channel read is complete.
runtime.KeepAlive(c) runtime.KeepAlive(c)
f.wg.Done()
return int(r.bytes), err return int(r.bytes), err
} }
@ -202,6 +201,7 @@ func (f *win32File) Read(b []byte) (int, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
defer f.wg.Done()
if f.readDeadline.timedout.isSet() { if f.readDeadline.timedout.isSet() {
return 0, ErrTimeout return 0, ErrTimeout
@ -228,6 +228,8 @@ func (f *win32File) Write(b []byte) (int, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
defer f.wg.Done()
if f.writeDeadline.timedout.isSet() { if f.writeDeadline.timedout.isSet() {
return 0, ErrTimeout return 0, ErrTimeout
} }

View file

@ -367,6 +367,8 @@ func connectPipe(p *win32File) error {
if err != nil { if err != nil {
return err return err
} }
defer p.wg.Done()
err = connectNamedPipe(p.handle, &c.o) err = connectNamedPipe(p.handle, &c.o)
_, err = p.asyncIo(c, nil, 0, err) _, err = p.asyncIo(c, nil, 0, err)
if err != nil && err != cERROR_PIPE_CONNECTED { if err != nil && err != cERROR_PIPE_CONNECTED {