summaryrefslogtreecommitdiff
path: root/lib/liberalstomp.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-31 15:27:58 -0500
committerEvan Prodromou <evan@status.net>2010-01-31 15:27:58 -0500
commit779204b194447397d0770d96e291d9491fd731b9 (patch)
treed0bfe36cc2b743fce8507e8cf6851467ccec8789 /lib/liberalstomp.php
parentbd5278302574ae3af87f09e0d8191c95ab93582a (diff)
parent81087e45c5b797028e90181459e4c673cd7be278 (diff)
Merge branch 'testing' into 0.9.x
Conflicts: actions/apioauthauthorize.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) {