|
@@ -16,7 +16,8 @@ interface IProcessor
|
|
|
class CentraHelper
|
|
|
{
|
|
|
const body_header_len = 10;
|
|
|
- const time_out = 3600;
|
|
|
+ const read_time_out = 600;
|
|
|
+ const write_time_out = 5;
|
|
|
|
|
|
|
|
|
private $socket;
|
|
@@ -52,7 +53,6 @@ class CentraHelper
|
|
|
public function run_loop($sockfd)
|
|
|
{
|
|
|
$this->socket = $sockfd;
|
|
|
- //$this->socket = stream_socket_server ($this->remote_addr(), $errno, $errstr);
|
|
|
echo "stream_set_blocking \n";
|
|
|
if(stream_set_blocking($this->socket, 0) == false) {
|
|
|
echo "stream_set_blocking error \n";
|
|
@@ -93,12 +93,11 @@ class CentraHelper
|
|
|
}
|
|
|
|
|
|
event_buffer_base_set($buffer, $base);
|
|
|
- event_buffer_timeout_set($buffer, self::time_out, self::time_out);
|
|
|
+ event_buffer_timeout_set($buffer, self::read_time_out, self::write_time_out);
|
|
|
event_buffer_watermark_set($buffer, EV_READ, 0, 0xffffff);
|
|
|
event_buffer_priority_set($buffer, 10);
|
|
|
event_buffer_enable($buffer, EV_READ | EV_PERSIST);
|
|
|
|
|
|
- // we need to save both buffer and connection outside
|
|
|
$this->connections[$this->connect_id] = $connection;
|
|
|
$this->buffers[$this->connect_id] = $buffer;
|
|
|
$this->contents[$this->connect_id] = "";
|