amphp / cluster

Building multi-core network applications with PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing resume in StreamResourceSendPipe ?

wtsergo opened this issue · comments

Hello,

I think there is missing suspension resume in
\Amp\Cluster\Internal\StreamResourceSendPipe::__construct
in onWritable callback success path
after
if (!$transferSocket->sendSocket($export, $data)) {
...
}

Not sure how to reproduce it because in \Amp\Cluster\Internal\StreamResourceSendPipe::send
$this->transferSocket->sendSocket does not return false for simple testcase
(using parent.php, child.php from your 'Transferring Client Sockets' example and client.php that connect to exposed socket)
But if it return false suspension won't be resumed.

Thanks,
Sergey

Thank you. Yes you're right, that was missing. That code path only gets followed if the transfer pipe is filled, a rare circumstance in practice. Seems I need to write more test cases to test that scenario.