Skip to content

Commit

Permalink
MNT: Bind to PORT 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhang committed Nov 7, 2019
1 parent a196396 commit a3fb3d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions caproto/sync/client.py
Expand Up @@ -48,6 +48,7 @@ def recv(circuit):
def search(pv_name, udp_sock, timeout, *, max_retries=2):
# Set Broadcaster log level to match our logger.
b = ca.Broadcaster(our_role=ca.CLIENT)
udp_sock.bind(('', 0))
b.our_address = udp_sock.getsockname()[:2]

# Send registration request to the repeater
Expand Down
1 change: 1 addition & 0 deletions caproto/threading/client.py
Expand Up @@ -340,6 +340,7 @@ def __init__(self, *, registration_retry_time=10.0):
self.listeners = weakref.WeakSet()

self.broadcaster = ca.Broadcaster(our_role=ca.CLIENT)
self.udp_sock.bind(('', 0))
self.broadcaster.our_address = self.udp_sock.getsockname()[:2]
self.log = logging.LoggerAdapter(
self.broadcaster.log, {'role': 'CLIENT'})
Expand Down

0 comments on commit a3fb3d5

Please sign in to comment.