When the socket is upgraded while we're probing
483352
function onupgrade(to) {
    if (transport$$1 && to.name !== transport$$1.name) {
      debug$5('"%s" works - aborting "%s"', to.name, transport$$1.name);
      freezeTransport();
    }
  }
266569
def update(self):
        """"""
        if self.input_method == 'local':
            # Only refresh:
            # * if there is not other scanning thread
            # * every refresh seconds (define in the configuration file)
            if self._thread is None:
                thread_is_running = False
            else:
                thread_is_running = self._thread.isAlive()
            if self.timer_ports.finished() and not thread_is_running:
                # Run ports scanner
                self._thread = ThreadScanner(self.stats)
                self._thread.start()
                # Restart timer
                if len(self.stats) > 0:
                    self.timer_ports = Timer(self.stats[0]['refresh'])
                else:
                    self.timer_ports = Timer(0)
        else:
            # Not available in SNMP mode
            pass

        return self.stats
23909
function(params, callback) {
      callback = callback || function(){};
      var t = this,
          errorText = '',
          router = Monitor.getRouter(),
          probeId = params.probeId,
          monitorProxy = t.incomingMonitorsById[probeId],
          firewall = t.get('firewall'),
          logCtxt = null,
          probe = null;

      // Already disconnected
      if (!monitorProxy || !monitorProxy.probe) {
        return callback(null);
      }

      // Get a good logging context
      probe = monitorProxy.probe;
      logCtxt = {
        probeClass: monitorProxy.get('probeClass'),
        initParams: monitorProxy.get('initParams'),
        probeId: probeId
      };

      // Called upon disconnect (internal or external)
      var onDisconnect = function(error) {
        if (error) {
          log.error(t.logId + 'probeDisconnect', error);
          return callback(error);
        }
        var duration = logCtxt.duration = Date.now() - probe.connectTime;
        probe.off('change', monitorProxy.probeChange);
        monitorProxy.probe = monitorProxy.probeChange = null;
        delete t.incomingMonitorsById[probeId];
        log.info(t.logId + 'probeDisconnected', logCtxt);
        stat.time(t.logId + 'probeDisconnected', duration);
        return callback(null);
      };

      // Disconnect from an internal or external probe
      if (probe && probe.connection) {
        router.disconnectExternal(probe.connection, probeId, onDisconnect);
      } else {
        router.disconnectInternal(probeId, onDisconnect);
      }
    }
225884
function onRepositorySet(repo) {
    if (repo instanceof Array) {
      socket.repositories = repo;
    }
    self.emit('connect', socket);
  }
224085
def on_connect(self, connection):
        ""
        self._stream = connection._reader
        self._buffer = SocketBuffer(self._stream, self._read_size)
        if connection.decode_responses:
            self.encoding = connection.encoding
464171
public void onFailedUpgrade() {
        assert (this.state == ConnectionState.CONNECTING);
        ConnectionState event = null;
        synchronized (this) {
            this.state = ConnectionState.CLOSED;
            cleanClose = false;
            inputAvailable = false;
            outputAvailable = false;
            event = this.state;
        }
        notifyStateListeners(event);
    }
241166
public void notifyAdapterDataSetChanged() {
        // handle our extensions
        for (IAdapterExtension<Item> ext : mExtensions.values()) {
            ext.notifyAdapterDataSetChanged();
        }
        cacheSizes();
        notifyDataSetChanged();
    }
1305564
function onupgrade(to){
    if (transport && to.name != transport.name) {
      debug('"%s" works - aborting "%s"', to.name, transport.name);
      freezeTransport();
    }
  }
377767
def probe_sync(self):
        """"""

        done = threading.Event()
        result = {}

        def probe_done(adapter_id, status, reason):
            result['success'] = status
            result['failure_reason'] = reason
            done.set()

        self.probe_async(probe_done)
        done.wait()

        return result
468330
def update_state(self):
        """"""
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(self._timeout)
        try:
            if sock.connect_ex((self._ip, self._port['state'])) == 0:
                self.state = True
            else:
                self.state = False
            sock.close()
        except socket.error:
            raise
1232325
def _nodedev_event_update_cb(conn, dev, opaque):
    '''
    
    '''
    _salt_send_event(opaque, conn, {
        'nodedev': {
            'name': dev.name()
        },
        'event': opaque['event']
    })
821421
@Override
  public void upgrade(Object protocol)
  {
    Objects.requireNonNull(protocol);

    if (protocol instanceof ServiceWebSocket) {
      ServiceWebSocket<?,?> webSocket = (ServiceWebSocket<?,?>) protocol;

      upgradeWebSocket(webSocket);
    }
    else {
      throw new IllegalArgumentException(protocol.toString());
    }
  }
60780
def probe_enable(cls, resource):
        
        oper = cls.call('hosting.rproxy.probe.enable', cls.usable_id(resource))
        cls.echo('Activating probe on %s' % resource)
        cls.display_progress(oper)
        cls.echo('The probe have been activated')
        return oper
582751
def socket_monitor_loop(self):
        '''  '''
        try:
            while True:
                gevent.socket.wait_read(self.socket.fileno())

                self._handle_log_rotations()
                self.capture_packet()
        finally:
            self.clean_up()
5419
def indication(self, pdu):
        """"""
        if _debug: TCPServer._debug("indication %r", pdu)

        self.request += pdu.pduData
38325
def upgrade(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
977540
def add_probe(self, probe):
        """"""
        if self.probes:
            probe_last = self.probes[-1]
            if not probe.ip:
                probe.ip = probe_last.ip
                probe.name = probe_last.name
        self.probes.append(probe)