| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,12 @@ function onConnect($serv, $client_id, $from_id) | |||
| 75 | 75 | function onClose($serv, $client_id, $from_id) | |
| 76 | 76 | { | |
| 77 | 77 | $this->log("client[#$client_id@$from_id] close"); | |
| 78 | - unset($this->requests[$client_id], $this->buffer_header[$client_id]); | ||
| 78 | + $this->cleanBuffer($client_id); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + function cleanBuffer($fd) | ||
| 82 | + { | ||
| 83 | + unset($this->requests[$fd], $this->buffer_header[$fd]); | ||
| 79 | 84 | } | |
| 80 | 85 | ||
| 81 | 86 | function checkHeader($client_id, $http_data) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -517,7 +517,7 @@ function onClose($serv, $client_id, $from_id) | |||
| 517 | 517 | { | |
| 518 | 518 | $this->onExit($client_id); | |
| 519 | 519 | $this->log("close client_id = $client_id"); | |
| 520 | - unset($this->ws_list[$client_id], $this->connections[$client_id], $this->requests[$client_id]); | ||
| 520 | + $this->cleanBuffer($client_id); | ||
| 521 | 521 | parent::onClose($serv, $client_id, $from_id); | |
| 522 | 522 | } | |
| 523 | 523 | ||
@@ -535,7 +535,17 @@ public function close($fd, $code = self::CLOSE_NORMAL, $reason = '') | |||
| 535 | 535 | { | |
| 536 | 536 | $this->send($fd, pack('n', $code).$reason, self::OPCODE_CONNECTION_CLOSE); | |
| 537 | 537 | $this->log("server close connection[$fd]. reason: $reason, close_code = $code"); | |
| 538 | - unset($this->ws_list[$fd], $this->connections[$fd], $this->requests[$fd], $this->buffer_header[$fd]); | ||
| 538 | + $this->cleanBuffer($fd); | ||
| 539 | 539 | return $this->server->close($fd); | |
| 540 | 540 | } | |
| 541 | + | ||
| 542 | + /** | ||
| 543 | + * 清理连接缓存区 | ||
| 544 | + * @param $fd | ||
| 545 | + */ | ||
| 546 | + function cleanBuffer($fd) | ||
| 547 | + { | ||
| 548 | + parent::cleanBuffer($fd); | ||
| 549 | + unset($this->ws_list[$fd], $this->connections[$fd]); | ||
| 550 | + } | ||
| 541 | 551 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments