summaryrefslogtreecommitdiff
path: root/lib/liberalstomp.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-02-02 17:00:10 -0500
committerCraig Andrews <candrews@integralblue.com>2010-02-02 17:00:10 -0500
commit057ec1fceacbfec1f755a5bc6700a188aa70e33f (patch)
tree297839a71d9d3a7a0a7935d5dbcc9c4a3c6c99bb /lib/liberalstomp.php
parentd14651706cf728f116b7ae44c6a6e37b5eb918a4 (diff)
parentf60f2c523f2e7018ea923898931287e7a99e8f44 (diff)
Merge branch '0.9.x' into 1.0.x
Conflicts: EVENTS.txt lib/imqueuehandler.php lib/jabber.php lib/util.php plugins/Xmpp/Sharing_XMPP.php
Diffstat (limited to 'lib/liberalstomp.php')
-rw-r--r--lib/liberalstomp.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/liberalstomp.php b/lib/liberalstomp.php
index c9233843a..3d38953fd 100644
--- a/lib/liberalstomp.php
+++ b/lib/liberalstomp.php
@@ -34,6 +34,22 @@ class LiberalStomp extends Stomp
}
/**
+ * Return the host we're currently connected to.
+ *
+ * @return string
+ */
+ function getServer()
+ {
+ $idx = $this->_currentHost;
+ if ($idx >= 0) {
+ $host = $this->_hosts[$idx];
+ return "$host[0]:$host[1]";
+ } else {
+ return '[unconnected]';
+ }
+ }
+
+ /**
* Make socket connection to the server
* We also set the stream to non-blocking mode, since we'll be
* select'ing to wait for updates. In blocking mode it seems
@@ -71,10 +87,12 @@ class LiberalStomp extends Stomp
// @fixme this sometimes hangs in blocking mode...
// shouldn't we have been idle until we found there's more data?
$read = fread($this->_socket, $rb);
- if ($read === false) {
- $this->_reconnect();
+ if ($read === false || ($read === '' && feof($this->_socket))) {
+ // @fixme possibly attempt an auto reconnect as old code?
+ throw new StompException("Error reading");
+ //$this->_reconnect();
// @fixme this will lose prior items
- return $this->readFrames();
+ //return $this->readFrames();
}
$data .= $read;
if (strpos($data, "\x00") !== false) {