FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

修复Task进程无法发送WebSocket数据帧的BUG · WJayWJay/framework@c35ba9d · GitHub

Repository navigation

Commit c35ba9d

Browse files
committed
修复Task进程无法发送WebSocket数据帧的BUG
1 parent 8f94c2d commit c35ba9d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎libs/Swoole/Protocol/CometServer.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ abstract class CometServer extends WebSocket
3131
*/
3232
function onStart($serv, $worker_id = 0)
3333
{
34-
$serv->addTimer(1000);
34+
if ($worker_id < $serv->setting['worker_num'])
35+
{
36+
$serv->addTimer(1000);
37+
}
3538
parent::onStart($serv, $worker_id);
3639
}
3740

@@ -128,7 +131,7 @@ function getSession($session_id)
128131
function send($session_id, $data, $opcode = self::OPCODE_TEXT_FRAME, $end = true)
129132
{
130133
//WebSocket
131-
if (isset($this->connections[$session_id]))
134+
if (!$this->isCometClient($session_id))
132135
{
133136
return parent::send($session_id, $data, $opcode, $end);
134137
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL