Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php |
— | — | @@ -36,7 +36,8 @@ |
37 | 37 | function efStompSetup(&$parser) { |
38 | 38 | global $wgParser, $wgOut; |
39 | 39 | |
40 | | - $parser->disableCache(); |
| 40 | + //redundant and causes Fatal Error |
| 41 | + //$parser->disableCache(); |
41 | 42 | |
42 | 43 | $wgParser->setHook( 'stomp', 'efStompTest' ); |
43 | 44 | |
Index: trunk/extensions/DonationInterface/activemq_stomp/Stomp.php |
— | — | @@ -484,6 +484,7 @@ |
485 | 485 | } |
486 | 486 | |
487 | 487 | $data = $stompFrame->__toString(); |
| 488 | + |
488 | 489 | $r = fwrite($this->_socket, $data, strlen($data)); |
489 | 490 | if ($r === false || $r == 0) { |
490 | 491 | $this->_reconnect(); |
— | — | @@ -510,21 +511,26 @@ |
511 | 512 | */ |
512 | 513 | public function readFrame () |
513 | 514 | { |
514 | | - /* if (!$this->hasFrameToRead()) { |
| 515 | + if (!$this->hasFrameToRead()) { |
515 | 516 | return false; |
516 | | - } */ |
| 517 | + } |
517 | 518 | |
| 519 | + stream_set_timeout($this->_socket, 5); |
518 | 520 | $rb = 1024; |
519 | 521 | $data = ''; |
520 | 522 | do { |
521 | 523 | $read = fgets($this->_socket, $rb); |
522 | | - if ($read === false) { |
523 | | - $this->_reconnect(); |
524 | | - return $this->readFrame(); |
| 524 | + $info = stream_get_meta_data($this->_socket); |
| 525 | + if ($info['timed_out']) { |
| 526 | + return FALSE; |
525 | 527 | } |
| 528 | + //if ($read === false) { |
| 529 | + // $this->_reconnect(); |
| 530 | + // return $this->readFrame(); |
| 531 | + //} |
526 | 532 | $data .= $read; |
527 | 533 | $len = strlen($data); |
528 | | - } while (($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n"))); |
| 534 | + } while ($read && ($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n"))); |
529 | 535 | |
530 | 536 | list ($header, $body) = explode("\n\n", $data, 2); |
531 | 537 | $header = explode("\n", $header); |
— | — | @@ -539,6 +545,7 @@ |
540 | 546 | } |
541 | 547 | } |
542 | 548 | $frame = new Stomp_Frame($command, $headers, trim($body)); |
| 549 | + |
543 | 550 | if (isset($frame->headers['amq-msg-type']) && $frame->headers['amq-msg-type'] == 'MapMessage') { |
544 | 551 | require_once 'Stomp/Message/Map.php'; |
545 | 552 | return new Stomp_Message_Map($frame); |
— | — | @@ -554,6 +561,8 @@ |
555 | 562 | */ |
556 | 563 | public function hasFrameToRead() |
557 | 564 | { |
| 565 | + return TRUE; // http://bugs.php.net/bug.php?id=46024 |
| 566 | + |
558 | 567 | $read = array($this->_socket); |
559 | 568 | $write = null; |
560 | 569 | $except = null; |