Skip to content

Commit 1d92eb4

Browse files
committed
If address is '0.0.0.0' or port is 0 run getsockname() on socket
and save result into address class attribute.
1 parent 78e30cf commit 1d92eb4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/sippy_lite/sippy/CLIManager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class CLIConnectionManager(object):
8888
accept_list = None
8989
serversock = None
9090
atr = None
91+
address = None
9192

9293
def __init__(self, command_cb, address = None, sock_owner = None, backlog = 16, \
9394
tcp = False, sock_mode = None):
@@ -115,6 +116,9 @@ def __init__(self, command_cb, address = None, sock_owner = None, backlog = 16,
115116
chown(address, sock_owner[0], sock_owner[1])
116117
if sock_mode != None:
117118
chmod(address, sock_mode)
119+
elif address[0] == '0.0.0.0' or address[1] == 0:
120+
address = self.serversock.getsockname()
121+
self.address = address
118122
self.serversock.listen(backlog)
119123
self.atr = _Acceptor(self)
120124

0 commit comments

Comments
 (0)