public function toggleCrypto($socket, Deferred $deferred, $toggle)
 {
     //set_error_handler([$this, 'handleError']);
     $result = stream_socket_enable_crypto($socket, $toggle, $this->method);
     //restore_error_handler();
     if (true === $result) {
         $this->loop->removeReadStream($socket);
         $deferred->resolve();
     } elseif (false === $result) {
         $this->loop->removeReadStream($socket);
         $deferred->reject(new UnexpectedValueException(sprintf('Unable to complete SSL/TLS handshake: %s', $this->errStr), $this->errno));
     } else {
         // need more data, will retry
     }
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function pause() : self
 {
     $this->loop->removeReadStream($this->stream);
     return $this;
 }