diff --git a/PHPDaemon/BoundSocket/Generic.php b/PHPDaemon/BoundSocket/Generic.php index 7684de99..2642c2bd 100755 --- a/PHPDaemon/BoundSocket/Generic.php +++ b/PHPDaemon/BoundSocket/Generic.php @@ -275,8 +275,12 @@ protected function initSecureContext() { if ($this->cafile !== null) { $params[\EventSslContext::OPT_CA_FILE] = $this->cafile; } - if ($this->tls) { + if ($this->tls === true) { $method = \EventSslContext::TLS_SERVER_METHOD; + } elseif ($this->tls === 'v11') { + $method = \EventSslContext::TLSv11_SERVER_METHOD; + } elseif ($this->tls === 'v12') { + $method = \EventSslContext::TLSv12_SERVER_METHOD; } elseif ($this->ssl === 'v3' || $this->ssl === true || $this->ssl === '1'){ $method = \EventSslContext::SSLv3_SERVER_METHOD; } elseif ($this->ssl === 'v2') { diff --git a/PHPDaemon/Servers/WebSocket/Connection.php b/PHPDaemon/Servers/WebSocket/Connection.php index a76cf88f..cc914629 100644 --- a/PHPDaemon/Servers/WebSocket/Connection.php +++ b/PHPDaemon/Servers/WebSocket/Connection.php @@ -134,7 +134,7 @@ public function sendFrame($data, $type = null, $cb = null) { return false; } - if ($this->finished) { + if ($this->finished && $type !== 'CONNCLOSE') { return false; } @@ -155,6 +155,9 @@ public function sendFrame($data, $type = null, $cb = null) { * @return void */ public function onFinish() { + + $this->sendFrame('', 'CONNCLOSE'); + if ($this->route) { $this->route->onFinish(); }