mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
rpcinet should not block in read(2) rpcs.
PiperOrigin-RevId: 199703609 Change-Id: I8153b0396b22a230a68d4b69c46652a5545f7630
This commit is contained in:
@@ -145,29 +145,8 @@ func (s *socketOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOS
|
||||
n, e := dst.CopyOut(ctx, res.Data)
|
||||
return int64(n), e
|
||||
}
|
||||
if se != syserr.ErrWouldBlock {
|
||||
return 0, se.ToError()
|
||||
}
|
||||
|
||||
// We'll have to block. Register for notifications and read again when ready.
|
||||
e, ch := waiter.NewChannelEntry(nil)
|
||||
s.EventRegister(&e, waiter.EventIn)
|
||||
defer s.EventUnregister(&e)
|
||||
|
||||
for {
|
||||
res, se := rpcRead(ctx.(*kernel.Task), req)
|
||||
if se == nil {
|
||||
n, e := dst.CopyOut(ctx, res.Data)
|
||||
return int64(n), e
|
||||
}
|
||||
if se != syserr.ErrWouldBlock {
|
||||
return 0, se.ToError()
|
||||
}
|
||||
|
||||
if err := ctx.(*kernel.Task).Block(ch); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return 0, se.ToError()
|
||||
}
|
||||
|
||||
func rpcWrite(t *kernel.Task, req *pb.SyscallRequest_Write) (uint32, *syserr.Error) {
|
||||
|
||||
Reference in New Issue
Block a user