Handle a 'session' in which we make a number of calls
420021
function WebsocketConnection(socket, url) {
  this.socket = socket;
  this.url = url;

  this.deferreds = {};
  this.nextRequestId = 0;

  this.onReply = this.onReply.bind(this);
  this.onEvent = this.onEvent.bind(this);
}
470962
def _call(self, method, *args, **kwargs):
        """"""

        assert self.session

        if not kwargs.get('verify'):
            kwargs['verify'] = self.SSL_VERIFY

        response = self.session.request(method, *args, **kwargs)
        response_json = response.text and response.json() or {}

        if response.status_code < 200 or response.status_code >= 300:
            message = response_json.get('error', response_json.get('message'))
            raise HelpScoutRemoteException(response.status_code, message)

        self.page_current = response_json.get(self.PAGE_CURRENT, 1)
        self.page_total = response_json.get(self.PAGE_TOTAL, 1)

        try:
            return response_json[self.PAGE_DATA_MULTI]
        except KeyError:
            pass

        try:
            return [response_json[self.PAGE_DATA_SINGLE]]
        except KeyError:
            pass

        return None
959077
void give(NGSession session) {
    synchronized (lock) {
      if (done) {
        // session is already signalled shutdown and removed from all collections
        return;
      }
      workingPool.remove(session);

      if (idlePool.size() < maxIdleSessions) {
        idlePool.add(session);
        return;
      }
    }
    session.shutdown();
  }
1272226
def call(self, procedure, *args, **kwargs):
        
        return self._async_session.call(procedure, *args, **kwargs)
848640
def handle_intermediate_response(self, item_session: ItemSession) -> Actions:
        '''
        '''
        self._waiter.reset()

        action = self.handle_response(item_session)

        return action
1010053
def calls(self, call):
        
        exp = self._get_current_call()
        exp.call_replacement = call
        return self
667256
def __call(self):
        
        try:
            if self.__callback is not None:
                self.__callback(self.__successes, self.__errors)
        except Exception as ex:
            self.__logger.exception("Error calling back count down "
                                    "handler: %s", ex)
        else:
            self.__called = True
1316419
public function handleRequests(): void
    {
        $tail_call = false;
        do {
            $this->arg = $this->simpleArg;
            $this->stack = [$this->arg];
            $this->idx = 0;
            $this->parser->parse();
            if (count($this->stack) > 1) {
                $arg = array_pop($this->stack);
                if ($arg instanceof ApplyArg) {
                    $this->apply($arg);
                } else {
                    $msg = 'Error: $arg should be of type ApplyArg, error in client';
                    $this->logger->critical($msg);
                    throw new Exception\RuntimeException($msg);
                }
                $tail_call = true;
            }
            $this->stack = null;
        } while ($tail_call);
    }
723983
function executeScheduledCall() {

	var call = scheduledCall;
	scheduledCall = undefined;

	if (call._step === 1) {
		reprocess();
	}
	else if (call._step === 2) {
		reparse();
	}
	else {
		reevaluate(call._clearContainerCache, undefined, call._contexts);
	}

}
228296
public function call() {
    $sessionId = $this->getApp()->getRequest()->headers('SESSION');
    
    $foundSession = call_user_func($this->sessionModelClass . '::init', $this->getApp());
    if($foundSession->findById($sessionId)) {
      $this->session = $foundSession;
      $this->getApp()->getRequest()->session = $this->session;
      $now = new \DateTime('now');
      $this->session->lastAccessed = $now;

      $user = User::init($this->getApp());
      $user->findById($this->session->userId);
      $user->lastAccessed = $now;
      $user->save();

      $this->session->user = $user;
    }

    if (!empty($this->next)) {
      $this->next->call();
    }
  }
793942
protected void afterInvoke(Method method, Object[] params) throws Exception {
        // Close the session
        if (session != null) {
            session.close();
        }
    }
478704
def attach_session(self):
        """"""
        proc = self.cmd('attach-session', '-t%s' % self.id)

        if proc.stderr:
            raise exc.LibTmuxException(proc.stderr)
1044611
def make_call_with_cb(self, fun, *args):
        """"""

        cid, event = self.handler.register_callback()
        argscp = list(args)
        argscp.append(cid)
        self.make_call(fun, *argscp)
        return event
757639
def call_many(self, callback, args):
        """"""
        if isinstance(callback, str):
            callback = getattr(self, callback)
        f = None
        for arg in args:
            f = callback(*arg)
        return f
1063733
def new_session(self):
        """"""
        body = yield from self._fetch_json(URL_LOGIN, self._new_session_data)
        self.sma_sid = jmespath.search('result.sid', body)
        if self.sma_sid:
            return True

        msg = 'Could not start session, %s, got {}'.format(body)

        if body.get('err'):
            if body.get('err') == 503:
                _LOGGER.error("Max amount of sessions reached")
            else:
                _LOGGER.error(msg, body.get('err'))
        else:
            _LOGGER.error(msg, "Session ID expected [result.sid]")
        return False
579003
def _handleCallInitiated(self, regexMatch, callId=None, callType=1):
        
        if self._dialEvent:
            if regexMatch:
                groups = regexMatch.groups()
                # Set self._dialReponse to (callId, callType)
                if len(groups) >= 2:
                    self._dialResponse = (int(groups[0]) , int(groups[1]))
                else:
                    self._dialResponse = (int(groups[0]), 1) # assume call type: VOICE
            else:
                self._dialResponse = callId, callType
            self._dialEvent.set()
997178
private function handleStrict(): void
    {
        if (!ini_get('session.use_strict_mode') || headers_sent()) {
            return;
        }

        $cookieName = session_name();
        if (empty($_COOKIE[$cookieName])) {
            return;
        }

        $sessionId = $_COOKIE[$cookieName];

        $identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);

        if ($this->storageDriver->sessionExists($identifier)) {
            return;
        }

        $newSessionId = session_create_id();
        session_id($newSessionId);
    }