Skip to content

Commit

Permalink
Merge pull request #1 from theorchard/release_candidate
Browse files Browse the repository at this point in the history
vid-27 if you enter wrong host name you will now get an exception
  • Loading branch information
orchardit committed Apr 1, 2015
2 parents 1733a10 + dddc674 commit d938043
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/FuseSource/Stomp/Stomp.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ class Stomp
protected $_subscriptions = array();
protected $_defaultPort = 61613;
protected $_currentHost = - 1;
protected $_attempts = 10;
protected $_attempts = 5;
protected $_username = '';
protected $_password = '';
protected $_sessionId;
protected $_version;
protected $_read_timeout_seconds = 60;
protected $_read_timeout_milliseconds = 0;
protected $_connect_timeout_seconds = 60;
protected $_connect_timeout_seconds = 30;
protected $_waitbuf = array();

/**
Expand Down Expand Up @@ -153,7 +153,7 @@ protected function _makeConnection ()
$connect_errno = null;
$connect_errstr = null;

while (! $connected && $att ++ < $this->_attempts) {
while (! $connected && $att++ <= $this->_attempts) {
if (isset($this->_params['randomize']) && $this->_params['randomize'] == 'true') {
$i = rand(0, count($this->_hosts) - 1);
} else {
Expand All @@ -171,7 +171,7 @@ protected function _makeConnection ()
$this->_socket = null;
}
$this->_socket = @fsockopen($scheme . '://' . $host, $port, $connect_errno, $connect_errstr, $this->_connect_timeout_seconds);
if (!is_resource($this->_socket) && $att >= $this->_attempts && !array_key_exists($i + 1, $this->_hosts)) {
if (!is_resource($this->_socket) && $att >= $this->_attempts) {
throw new StompException("Could not connect to $host:$port ($att/{$this->_attempts})");
} else if (is_resource($this->_socket)) {
$connected = true;
Expand Down Expand Up @@ -355,7 +355,7 @@ public function subscribe ($destination, $properties = null, $sync = null)
} else if ($this->brokerVendor == 'RMQ') {
$headers['prefetch-count'] = $this->prefetchSize;
}

if ($this->clientId != null) {
if ($this->brokerVendor == 'AMQ') {
$headers['activemq.subscriptionName'] = $this->clientId;
Expand Down Expand Up @@ -687,7 +687,7 @@ public function hasFrameToRead()
* Reconnects and renews subscriptions (if there were any)
* Call this method when you detect connection problems
*/
protected function _reconnect ()
public function _reconnect ()
{
$subscriptions = $this->_subscriptions;

Expand Down

0 comments on commit d938043

Please sign in to comment.