Google is committed to advancing racial equity for Black communities. See how.

connect method

*<Null safety>*
  • @override

int connect (int flags, int mode, InterfaceRequest request, [int parentFlags = Flags.fsRights]) override

Connects to this instance of PseudoDir and serves over fidl.


int connect(int flags, int mode, fidl.InterfaceRequest<Node> request,
    [int parentFlags = Flags.fsRights]) {
  if (_isClosed) {
    sendErrorEvent(flags, ZX.ERR_NOT_SUPPORTED, request);
  // There should be no modeType* flags set, except for, possibly,
  // modeTypeDirectory when the target is a pseudo dir.
  if ((mode & ~modeProtectionMask) & ~modeTypeDirectory != 0) {
    sendErrorEvent(flags, ZX.ERR_INVALID_ARGS, request);

  var connectFlags = filterForNodeReference(flags);

  if (Flags.isPosix(connectFlags)) {
    // grant POSIX clients additional rights
    var parentRights = parentFlags & Flags.fsRights;
    connectFlags |= parentRights;
    connectFlags &= ~openFlagPosix;
    // Mounting is not supported
    connectFlags &= ~openRightAdmin;

  var status = _validateFlags(connectFlags);
  if (status != ZX.OK) {
    sendErrorEvent(connectFlags, status, request);
    return status;
  var connection = _DirConnection(
      mode, connectFlags, this, fidl.InterfaceRequest(request.passChannel()));
  return ZX.OK;