Skip to content
Browse files

Allow the host resolutions in 'list_connections' to fail to resolve.

  • Loading branch information...
1 parent 3649c3b commit d3271deb1d9a7ffc57b09dbcc68335e9e7c71393 @clemesha-ooi clemesha-ooi committed May 18, 2010
Showing with 11 additions and 2 deletions.
  1. +11 −2 rabbitmqctl_service.py
View
13 rabbitmqctl_service.py
@@ -227,13 +227,22 @@ def list_connections(self, connectioninfoitem=None):
for v in result:
address = ".".join([str(e) for e in v[1][1]])
peer_address = ".".join([str(e) for e in v[3][1]])
+ #XXX are the below 'try/except' blocks needed? Put a timeout in these calls?
+ try:
+ host = socket.gethostbyaddr(address)[0]
+ except:
+ host = "<'host' could not be resolved for address='%s'>" % address
+ try:
+ peer_host = socket.gethostbyaddr(peer_address)[0]
+ except:
+ peer_host = "<'peer_host' could not be resolved for peer_address='%s'>" % peer_address
info_all.append({
"pid":v[0][1].nodeName.text,
"address":address,
- "host":socket.gethostbyaddr(address)[0],
+ "host":host,
"port":str(v[2][1]),
"peer_address":peer_address,
- "peer_host":socket.gethostbyaddr(peer_address)[0],
+ "peer_host":peer_host,
"peer_port":str(v[4][1]),
"recv_oct":str(v[5][1]),
"recv_cnt":str(v[6][1]),

0 comments on commit d3271de

Please sign in to comment.
Something went wrong with that request. Please try again.