checks the node-mcu connection
554486
function checkConnection(){

    return new Promise(function(resolve, reject){

        // 1.5s connection timeout
        const watchdog = setTimeout(function(){
            // throw error
            reject(new Error('Timeout, no response detected - is NodeMCU online and the Lua interpreter ready ?'));
        }, 1500);

        // send a simple print command to the lua engine
        _virtualTerminal.executeCommand(_luaCommandBuilder.command.echo)
            .then(({echo, response}) => {
                // clear watchdog
                clearTimeout(watchdog);

                // validate command echo and command output
                if (response == 'echo1337' && echo == 'print("echo1337")') {
                    resolve();
                } else {
                    _logger.log('Echo:', echo);
                    _logger.debug('Response:', response);
                    reject(new Error('No response detected - is NodeMCU online and the Lua interpreter ready ?'));
                }
            })
            .catch(reject)
    });

}
790115
def timed_connectivity_check(self, event):
        """"""
        self.status = self._can_connect()
        self.log('Timed connectivity check:', self.status, lvl=verbose)

        if self.status:
            if not self.old_status:
                self.log('Connectivity gained')
                self.fireEvent(backend_nodestate_toggle(STATE_UUID_CONNECTIVITY, on=True, force=True))
        else:
            if self.old_status:
                self.log('Connectivity lost', lvl=warn)
                self.old_status = False
                self.fireEvent(backend_nodestate_toggle(STATE_UUID_CONNECTIVITY, off=True, force=True))

        self.old_status = self.status
155469
static function checkNodeID( $module, $view, $nodeID )
    {
        if ( !eZSSLZone::enabled() )
            return;

        /* If the given module/view is not in the list of 'keep mode' views,
         * i.e. it cannot choose access mode itself,
         * then do nothing.
         */
        if ( !eZSSLZone::isKeepModeView( $module, $view ) )
            return;

        // Fetch path string for the given node.
        $pathStrings = eZPersistentObject::fetchObjectList(
            eZContentObjectTreeNode::definition(), // def
            array( 'path_string' ),                // field_filters
            array( 'node_id' => $nodeID ),         // conds
            null,                                  // sorts
            null,                                  // limit
            false                                  // asObject
        );

        if ( !$pathStrings )
        {
            eZDebug::writeError( "Node #$nodeID not found", __METHOD__ );
            return;
        }

        eZSSLZone::checkNodePath( $module, $view, $pathStrings[0]['path_string'] );
    }
939220
def check_for_connection(self):
        
        for idx, arg in enumerate(self.args):
            if arg.startswith('@'):
                if arg[1:] not in config.connections:
                    self.parser.error("Undefined connection '{}'!".format(arg[1:]))
                config.scgi_url = config.connections[arg[1:]]
                self.LOG.debug("Switched to connection %s (%s)", arg[1:], config.scgi_url)
                del self.args[idx]
                break
785444
def validate_node(self, node_ip, node_port=None, same_nodes=1):
        self.debug_print("Validating: " + node_ip)

        # Is this a valid IP?
        if not is_ip_valid(node_ip) or node_ip == "0.0.0.0":
            self.debug_print("Invalid node ip in validate node")
            return 0

        # Is this a valid port?
        if node_port != 0 and node_port is not None:
            if not is_valid_port(node_port):
                self.debug_print("Invalid node port in validate port")
                return 0

        
        if not self.enable_duplicate_ip_cons:
            # Don't connect to ourself.
            if (node_ip == "127.0.0.1" or
                    node_ip == get_lan_ip(self.interface) or
                    node_ip == self.wan_ip):
                self.debug_print("Cannot connect to ourself.")
                return 0

            # No, really: don't connect to ourself.
            if node_ip == self.passive_bind and node_port == self.passive_port:
                self.debug_print("Error connecting to same listen server.")
                return 0

            # Don't connect to same nodes.
            if same_nodes:
                for node in self.outbound + self.inbound:
                    try:
                        addr, port = node["con"].s.getpeername()
                        if node_ip == addr:
                            self.debug_print("Already connected to this node.")
                            return 0
                    except Exception as e:
                        print(e)
                        return 0

        return 1
232859
private void checkDrain() {
    if (full && !paused && messages.size() < maxQueueSize / 2) {
      full = false;
      log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
      if (drainHandler != null) {
        drainHandler.handle((Void) null);
      }
    }
  }
796908
def determine_node(self):
        

        # Manually set node_type as simultaneous.
        if self.node_type == "simultaneous":
            if self.nat_type != "unknown":
                return "simultaneous"

        # Get IP of binding interface.
        unspecific_bind = ["0.0.0.0", "127.0.0.1", "localhost"]
        if self.passive_bind in unspecific_bind:
            lan_ip = get_lan_ip(self.interface)
        else:
            lan_ip = self.passive_bind

        # Passive node checks.
        if lan_ip is not None \
                and self.passive_port is not None and self.enable_forwarding:
            self.debug_print("Checking if port is forwarded.")

            # Check port isn't already forwarded.
            if is_port_forwarded(lan_ip, self.passive_port, "TCP",
                                 self.forwarding_servers):
                msg = "Port already forwarded. Skipping NAT traversal."
                self.debug_print(msg)

                self.forwarding_type = "forwarded"
                return "passive"
            else:
                self.debug_print("Port is not already forwarded.")

            # Most routers.
            try:
                self.debug_print("Trying UPnP")

                UPnP(self.interface).forward_port("TCP", self.passive_port,
                                                  lan_ip)

                if is_port_forwarded(lan_ip, self.passive_port, "TCP",
                                     self.forwarding_servers):
                    self.forwarding_type = "UPnP"
                    self.debug_print("Forwarded port with UPnP.")
                else:
                    self.debug_print("UPnP failed to forward port.")

            except Exception as e:
                # Log exception.
                error = parse_exception(e)
                log_exception(self.error_log_path, error)
                self.debug_print("UPnP failed to forward port.")

                # Apple devices.
                try:
                    self.debug_print("Trying NATPMP.")
                    NatPMP(self.interface).forward_port("TCP",
                                                        self.passive_port,
                                                        lan_ip)
                    if is_port_forwarded(lan_ip, self.passive_port, "TCP",
                                         self.forwarding_servers):
                        self.forwarding_type = "NATPMP"
                        self.debug_print("Port forwarded with NATPMP.")
                    else:
                        self.debug_print("Failed to forward port with NATPMP.")
                        self.debug_print("Falling back on TCP hole punching or"
                                         " proxying.")
                except Exception as e:
                    # Log exception
                    error = parse_exception(e)
                    log_exception(self.error_log_path, error)
                    self.debug_print("Failed to forward port with NATPMP.")

            # Check it worked.
            if self.forwarding_type != "manual":
                return "passive"

        # Fail-safe node types.
        if self.nat_type != "unknown":
            return "simultaneous"
        else:
            return "active"
233712
static <K extends Comparable<K>> void checkNode(Node<K> node) {
        node.checkNode(null, null);
    }
240144
def is_connected(self):
        
        nids = set(self._nodeids)  # the nids left to find
        if len(nids) == 0:
            raise XmrsError('Cannot compute connectedness of an empty Xmrs.')
        # build a basic dict graph of relations
        edges = []
        # label connections
        for lbl in self.labels():
            lblset = self.labelset(lbl)
            edges.extend((x, y) for x in lblset for y in lblset if x != y)
        # argument connections
        _vars = self._vars
        for nid in nids:
            for rarg, tgt in self.args(nid).items():
                if tgt not in _vars:
                    continue
                if IVARG_ROLE in _vars[tgt]['refs']:
                    tgtnids = list(_vars[tgt]['refs'][IVARG_ROLE])
                elif tgt in self._hcons:
                    tgtnids = list(self.labelset(self.hcon(tgt)[2]))
                elif 'LBL' in _vars[tgt]['refs']:
                    tgtnids = list(_vars[tgt]['refs']['LBL'])
                else:
                    tgtnids = []
                # connections are bidirectional
                edges.extend((nid, t) for t in tgtnids if nid != t)
                edges.extend((t, nid) for t in tgtnids if nid != t)
        g = {nid: set() for nid in nids}
        for x, y in edges:
            g[x].add(y)
        connected_nids = _bfs(g)
        if connected_nids == nids:
            return True
        elif connected_nids.difference(nids):
            raise XmrsError(
                'Possibly bogus nodeids: {}'
                .format(', '.join(connected_nids.difference(nids)))
            )
        return False
1090222
def get_connected(self):
        
        connected = c_int32()
        result = self.library.Cli_GetConnected(self.pointer, byref(connected))
        check_error(result, context="client")
        return bool(connected)
1202956
private void checkPotentiallyTimedOutConnection() {
    boolean stillCheckingTimeouts = true;
    while (stillCheckingTimeouts) {
      try {
        for (SelectionKey sk : selector.keys()) {
          MemcachedNode mn = (MemcachedNode) sk.attachment();
          if (mn.getContinuousTimeout() > timeoutExceptionThreshold) {
            getLogger().warn("%s exceeded continuous timeout threshold", sk);
            lostConnection(mn);
          }
        }
        stillCheckingTimeouts = false;
      } catch(ConcurrentModificationException e) {
        getLogger().warn("Retrying selector keys after "
          + "ConcurrentModificationException caught", e);
        continue;
      }
    }
  }
208350
function check(node) {
    				var scope = context.getScope();
    				checkScope(scope);
    				// If using ES6 modules check the child 'module' scope
    				if (node.type === "Program" && node.sourceType === "module"){
    					checkScope(scope.childScopes[0]);
    				}
        		}
813798
def check (self):
        """"""
        if self.aggregate.config["trace"]:
            trace.trace_on()
        try:
            self.local_check()
        except (socket.error, select.error):
            # on Unix, ctrl-c can raise
            # error: (4, 'Interrupted system call')
            etype, value = sys.exc_info()[:2]
            if etype == errno.EINTR:
                raise KeyboardInterrupt(value)
            else:
                raise
380757
def on_assert(self, node):    # ('test', 'msg')
        """"""
        if not self.run(node.test):
            self.raise_exception(node, exc=AssertionError, msg=node.msg)
        return True
222132
function tryConnect() {
    if (!seleniumIP) {
        process.nextTick(buildDriver);
        return;
    }
    const sock = net.connect({
        host: seleniumIP,
        port: +seleniumPort,
    });
    sock.on("connect", function() {
        sock.end();
        attempts = 0;
        process.nextTick(buildDriver);
    }).on("error", function() {
        if (++attempts > 50) {
            throw new Error("Failed to connect selenium server.");
        }
        setTimeout(tryConnect, 200);
    });
}
149724
private void checkForConnectionInFreePool(MCWrapper mcw) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "checkForConnectionInFreePool");
        }
        int hashMapBucket = mcw.getHashMapBucket();

        /*
         * Attempt to remove the mcw from the free pool
         */
        if (freePool[hashMapBucket].removeMCWrapperFromList(mcw)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "Managed connection wrapper was removed from the free pool wrapper list.  mcw is " + mcw);
            }
            /*
             * The connection was in the free pool, cleaup and destroy the mc.
             */
            freePool[hashMapBucket].cleanupAndDestroyMCWrapper(mcw);
            /*
             * Finish the work needed in the free pool for this mcw.
             *
             * Parms on the removeMCWrapperFromList are:
             * MCWrapper object = mcw
             * removeFromFreePool = false (we alread removed the connection)
             * synchronizationNeeded = true (we are not sync'ed, so the method will need to sync)
             * skipWaiterNotify = false (if there are waiters, we should wake-up one of them)
             * decrementTotalCounter = true (if we are going to wake-up a waiter, we need to allow
             * the waiter to create a connection if total is at its max)
             */
            freePool[hashMapBucket].removeMCWrapperFromList(mcw, false, true, false, true);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "checkForConnectionInFreePool");
        }
    }
249433
def checkNode(self, namespaceURI=None, localName=None):
        '''
            
        '''
        namespaceURI = namespaceURI or self.namespaceURI
        localName = localName or self.name
        check = False
        if localName and self.node:
            check = self._dom.isElement(self.node, localName, namespaceURI)
        if not check:
            raise NamespaceError, 'unexpected node type %s, expecting %s' %(self.node, localName)