Beispiel #1
0
 /**
  * @override
  * @inheritDoc
  */
 public function handleError(NetworkConnectionInterface $conn, $ex)
 {
     if ($conn->httpHeadersReceived) {
         $this->httpServer->handleError($conn, $ex);
     } else {
         $this->close($conn, 500);
     }
 }
Beispiel #2
0
 /**
  * Handler triggered when an error has occured during doing operation on existing connection.
  *
  * @param SocketInterface $socket
  * @param Error|Exception $ex
  */
 public function handleError($socket, $ex)
 {
     try {
         $this->component->handleError($socket->conn, $ex);
     } catch (Error $ex) {
         $this->close($socket);
     } catch (Exception $ex) {
         $this->close($socket);
     }
 }
Beispiel #3
0
 /**
  * @override
  * @inheritDoc
  */
 protected function attemptUpgrade(NetworkConnectionInterface $conn)
 {
     $request = $conn->WebSocket->request;
     if (!$this->wsDriver->checkVersion($request)) {
         return $this->close($conn);
     }
     $conn->WebSocket->version = $this->wsDriver->getVersion($request);
     try {
         $response = $conn->WebSocket->version->wsHandshake($request);
     } catch (Error $ex) {
         return;
     } catch (Exception $ex) {
         return;
     }
     $conn->send($response);
     if ($response->getStatusCode() !== 101) {
         return $conn->close();
     }
     $upgraded = $conn->WebSocket->version->wsUpgrade($conn, $this->wsServer);
     $this->connCollection->attach($conn, $upgraded);
     $upgraded->WebSocket->established = true;
     $this->wsServer->handleConnect($upgraded);
 }
Beispiel #4
0
 /**
  * @override
  * @inheritDoc
  */
 public function handleError(NetworkConnectionInterface $conn, $ex)
 {
     return $this->component->handleError($conn, $ex);
 }
 /**
  * @override
  * @inheritDoc
  */
 public function handleError(NetworkConnectionInterface $conn, $ex)
 {
     if (!$this->isAddressBlocked($conn->getHost())) {
         $this->component->handleError($conn, $ex);
     }
 }