Skip to content

Commit

Permalink
Merge pull request #985 from slaclab/server_addr
Browse files Browse the repository at this point in the history
Fix suggested default address. Fix broken address/port lookup
  • Loading branch information
ruck314 authored Feb 7, 2024
2 parents dd99795 + 8563cb4 commit e250419
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/migration/rogue_v6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Similiarly the previous feature which allowed the user to pass the root class to
pollEn=True)
# Add zmq server, keep it as an attribute so we can access it later
self.zmqServer = pyrogue.interfaces.ZmqServer(root=self, addr='*', port=0)
self.zmqServer = pyrogue.interfaces.ZmqServer(root=self, addr='127.0.0.1', port=0)
self.addInterface(self.zmqServer)
with ExampleRoot() as root:
Expand Down
2 changes: 1 addition & 1 deletion python/pyrogue/examples/_ExampleRoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, epics4En=False):
self.add(pyrogue.RunControl())

# Add zmq server
self.zmqServer = pyrogue.interfaces.ZmqServer(root=self, addr='*', port=0)
self.zmqServer = pyrogue.interfaces.ZmqServer(root=self, addr='127.0.0.1', port=0)
self.addInterface(self.zmqServer)

# Add sql logger
Expand Down
6 changes: 5 additions & 1 deletion python/pyrogue/interfaces/_ZmqServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ class ZmqServer(rogue.interfaces.ZmqServer):
def __init__(self,*,root,addr,port,incGroups=None, excGroups=['NoServe']):
rogue.interfaces.ZmqServer.__init__(self,addr,port)
self._root = root
self._addr = addr
self._root.addVarListener(func=self._varUpdate, done=self._varDone, incGroups=incGroups, excGroups=excGroups)
self._updateList = {}

@property
def address(self):
return f"localhost:{self.port()}"
if self._addr == "*":
return f"127.0.0.1:{self.port()}"
else:
return f"{self._addr}:{self.port()}"

def _doOperation(self,d):
path = d['path'] if 'path' in d else None
Expand Down

0 comments on commit e250419

Please sign in to comment.