예제 #1
0
 public function handleData($stream)
 {
     if (!$this->secure) {
         //stream_set_blocking($this->stream, true);
         $result = stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLS_SERVER);
         //stream_set_blocking($this->stream, false);
         if (0 === $result) {
             return;
         }
         if (false === $result) {
             echo "error\n";
             return;
         }
         $this->secure = true;
         $this->emit('connection', array($this));
     }
     parent::handleData($stream);
 }