2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-03-03 17:51:00 +00:00

Allow Unix socket for http socket

If service.cfg has:
[http]
bindhost = /var/run/confluent/httpapi

Then it will use the cited path to create a unix socket instead
of a network socket.
This commit is contained in:
Jarrod Johnson 2025-01-08 15:59:48 -05:00
parent 0cae0fe06e
commit e2bb72cc14

View File

@ -1195,8 +1195,17 @@ def serve(bind_host, bind_port):
sock = None
while not sock:
try:
sock = eventlet.listen(
(bind_host, bind_port, 0, 0), family=socket.AF_INET6)
if '/' in bind_host:
try:
os.remove(bind_host)
except Exception:
pass
sock = eventlet.listen(
bind_host, family=socket.AF_UNIX)
os.chmod(bind_host, 0o666)
else:
sock = eventlet.listen(
(bind_host, bind_port, 0, 0), family=socket.AF_INET6)
except socket.error as e:
if e.errno != 98:
raise