mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
rpcinet connect doesn't handle all errnos correctly.
These were causing non-blocking related errnos to be returned to the sentry when they were created as blocking FDs internally. PiperOrigin-RevId: 197962932 Change-Id: I3f843535ff87ebf4cb5827e9f3d26abfb79461b0
This commit is contained in:
@@ -213,21 +213,19 @@ func (s *socketOperations) Connect(t *kernel.Task, sockaddr []byte, blocking boo
|
||||
// Register for notification when the endpoint becomes writable, then
|
||||
// initiate the connection.
|
||||
e, ch := waiter.NewChannelEntry(nil)
|
||||
s.EventRegister(&e, waiter.EventOut)
|
||||
s.EventRegister(&e, waiter.EventOut|waiter.EventIn|waiter.EventHUp)
|
||||
defer s.EventUnregister(&e)
|
||||
for {
|
||||
if err := rpcConnect(t, s.fd, sockaddr); err == nil || err != syserr.ErrInProgress && err != syserr.ErrAlreadyInProgress {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := rpcConnect(t, s.fd, sockaddr); err != syserr.ErrConnectStarted && err != syserr.ErrAlreadyConnecting {
|
||||
return err
|
||||
// It's pending, so we have to wait for a notification, and fetch the
|
||||
// result once the wait completes.
|
||||
if err := t.Block(ch); err != nil {
|
||||
return syserr.FromError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// It's pending, so we have to wait for a notification, and fetch the
|
||||
// result once the wait completes.
|
||||
if err := t.Block(ch); err != nil {
|
||||
return syserr.FromError(err)
|
||||
}
|
||||
|
||||
// Call Connect() again after blocking to find connect's result.
|
||||
return rpcConnect(t, s.fd, sockaddr)
|
||||
}
|
||||
|
||||
func rpcAccept(t *kernel.Task, fd uint32, peer bool) (*pb.AcceptResponse_ResultPayload, *syserr.Error) {
|
||||
|
||||
Reference in New Issue
Block a user