// Recv implements transport.Receiver.Recv.
Recv implements transport.Receiver.Recv.
// Recv implements transport . Receiver . Recv .
func (c *ConnectedEndpoint) Recv(ctx context.Context, data [][]byte, creds bool, numRights int, peek bool) (int64, int64, transport.ControlMessages, bool, tcpip.FullAddress, bool, *syserr.Error) {
	c.mu.RLock()
	defer c.mu.RUnlock()
	var cm unet.ControlMessage
	if numRights > 0 {
		cm.EnableFDs(int(numRights))
	}
	rl, ml, cl, cTrunc, err := fdReadVec(c.fd, data, []byte(cm), peek, c.RecvMaxQueueSize())
	if rl > 0 && err != nil {
		err = nil
	}
	if err != nil {
		return 0, 0, transport.ControlMessages{}, false, tcpip.FullAddress{}, false, syserr.FromError(err)
	}
	if cl < uint64(len(cm)) {
		cm = cm[:cl]
	}
	if len(cm) == 0 {
		return rl, ml, transport.ControlMessages{}, cTrunc, tcpip.FullAddress{Addr: tcpip.Address(c.addr)}, false, nil
	}
	fds, err := cm.ExtractFDs()
	if err != nil {
		return 0, 0, transport.ControlMessages{}, false, tcpip.FullAddress{}, false, syserr.FromError(err)
	}
	if len(fds) == 0 {
		return rl, ml, transport.ControlMessages{}, cTrunc, tcpip.FullAddress{Addr: tcpip.Address(c.addr)}, false, nil
	}
	return rl, ml, control.NewVFS2(nil, nil, newSCMRights(fds)), cTrunc, tcpip.FullAddress{Addr: tcpip.Address(c.addr)}, false, nil
}
func ( c * ConnectedEndpoint ) Recv ( ctx context . Context , data [ ] [ ] byte , creds bool , numRights int , peek bool ) ( int64 , int64 , transport . ControlMessages , bool , tcpip . FullAddress , bool , * syserr . Error ) { c . mu . RLock ( ) defer c . mu . RUnlock ( ) var cm unet . ControlMessage if numRights > 0 { cm . EnableFDs ( int ( numRights ) ) } rl , ml , cl , cTrunc , err := fdReadVec ( c . fd , data , [ ] byte ( cm ) , peek , c . RecvMaxQueueSize ( ) ) if rl > 0 && err != nil { err = nil } if err != nil { return 0 , 0 , transport . ControlMessages { } , false , tcpip . FullAddress { } , false , syserr . FromError ( err ) } if cl < uint64 ( len ( cm ) ) { cm = cm [ : cl ] } if len ( cm ) == 0 { return rl , ml , transport . ControlMessages { } , cTrunc , tcpip . FullAddress { Addr : tcpip . Address ( c . addr ) } , false , nil } fds , err := cm . ExtractFDs ( ) if err != nil { return 0 , 0 , transport . ControlMessages { } , false , tcpip . FullAddress { } , false , syserr . FromError ( err ) } if len ( fds ) == 0 { return rl , ml , transport . ControlMessages { } , cTrunc , tcpip . FullAddress { Addr : tcpip . Address ( c . addr ) } , false , nil } return rl , ml , control . NewVFS2 ( nil , nil , newSCMRights ( fds ) ) , cTrunc , tcpip . FullAddress { Addr : tcpip . Address ( c . addr ) } , false , nil }
Recv implements transport.Receiver.Recv.
Recv implements transport . Receiver . Recv .
// N.B. Unix sockets don't have a receive buffer, the send buffer // serves both purposes. // We got some data, so all we need to do on error is return // the data that we got. Short reads are fine, no need to // block. // There is no need for the callee to call RecvNotify because fdReadVec uses // the host's recvmsg(2) and the host kernel's queue. // Trim the control data if we received less than the full amount. // Avoid extra allocations in the case where there isn't any control data.