Skip to content

Commit

Permalink
Changing code to try port 5672 first and then on exception try port 80.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett T. Hannigan committed Mar 23, 2014
1 parent d41e313 commit 752a32e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions installer/install_suns.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ def run(self):
credentials = PlainCredentials('suns-client', 'suns-client')
try:
# Connection initialization
connection = BlockingConnection(
ConnectionParameters(
host = self.suns_server_address,
credentials = credentials,
virtual_host = 'suns-vhost'))
def connect(port):
return BlockingConnection(
ConnectionParameters(host=self.suns_server_address,
port=port,
credentials=credentials,
virtual_host='suns-vhost'))
try:
connect(5672)
except:
connect(80)
try:
# Channel Initialization
self.channel = connection.channel()
Expand Down
16 changes: 10 additions & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ def run(self):

credentials = PlainCredentials('suns-client', 'suns-client')
try:
# Connection initialization
connection = BlockingConnection(
ConnectionParameters(
host = self.suns_server_address,
credentials = credentials,
virtual_host = 'suns-vhost'))
def connect(port):
return BlockingConnection(
ConnectionParameters(host=self.suns_server_address,
port=port,
credentials=credentials,
virtual_host='suns-vhost'))
try:
connect(5672)
except:
connect(80)
try:
# Channel Initialization
self.channel = connection.channel()
Expand Down

0 comments on commit 752a32e

Please sign in to comment.