Skip to content

Commit

Permalink
Merge pull request #218 from Antowka/master
Browse files Browse the repository at this point in the history
Fix close connection - send 0x8 before close connect
  • Loading branch information
kakserpom committed Oct 15, 2015
2 parents 3c90077 + ce52d02 commit 3b3200c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion PHPDaemon/BoundSocket/Generic.php
Expand Up @@ -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') {
Expand Down
5 changes: 4 additions & 1 deletion PHPDaemon/Servers/WebSocket/Connection.php
Expand Up @@ -134,7 +134,7 @@ public function sendFrame($data, $type = null, $cb = null) {
return false;
}

if ($this->finished) {
if ($this->finished && $type !== 'CONNCLOSE') {
return false;
}

Expand All @@ -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();
}
Expand Down

0 comments on commit 3b3200c

Please sign in to comment.